def main(self): self.log.debug('tasklet main function running') xpath = '/rw-dts-toy-tasklet:a-container' ret = toyyang.AContainer() ret.a_string = 'pub' events = [asyncio.Event(loop=self.loop) for _ in range(2)] @asyncio.coroutine def on_ready(*args): yield from asyncio.sleep(1, loop=self.loop) events[0].set() @asyncio.coroutine def on_prepare(xact_info, *args): xact_info.respond_xpath(rwdts.XactRspCode.ACK, xpath, ret) handler = rift.tasklets.DTS.RegistrationHandler(on_ready=on_ready, on_prepare=on_prepare) self.reg = yield from self._dts.register(xpath, flags=rwdts.Flag.PUBLISHER, handler=handler) yield from events[1].wait() # Normally this wouldn't be done, but all the printing of ticks is annoying self.log.debug('tasklet main finished')