Ejemplo n.º 1
0
 def on_callback(self, message: IncomingMessage):
     func_name = message.headers['FuncName']
     func = self.routes.get(func_name)
     if func:
         with message.process(requeue=True, ignore_processed=True):
             data = self.deserialize(message.body)
             yield from self._execute(func, data)
Ejemplo n.º 2
0
 async def on_message(self, func, message: IncomingMessage):
     with message.process(requeue=True, ignore_processed=True):
         data = self.deserialize(message.body)
         # logging.info(f"on_message: got data: {data}")
         try:
             await self.execute(func, data)
         except ChannelClosed as e:
             logging.error(e)
             await self.connect()
             await self.execute(func, data)
Ejemplo n.º 3
0
    async def on_message(self, func, message: IncomingMessage):
        with message.process(requeue=True, ignore_processed=True):
            data = self.deserialize(message.body)

            try:
                await self.execute(func, data)
            except RejectMessage as e:
                message.reject(requeue=e.requeue)
            except NackMessage as e:
                message.nack(requeue=e.requeue)
Ejemplo n.º 4
0
 def on_message(self, func, message: IncomingMessage):
     with message.process(requeue=True, ignore_processed=True):
         data = self.deserialize(message.body)
         yield from self.execute(func, data)
Ejemplo n.º 5
0
 async def on_message(self, message: IncomingMessage):
     async with message.process():
         future = self.futures.pop(message.correlation_id)
         future.set_result(message.body.decode())