Ejemplo n.º 1
0
 def message_handler():
     try:
         event = Event.deserialize(body)
         self.handler(event)
         message.ack()
     except:
         logger.exception('failed to handle event from queue %r', self.handler.queue_name)
Ejemplo n.º 2
0
 def message_handler():
     event = Event.deserialize(body)
     try:
         self.handler(event)
     except:
         raise
     else:
         message.ack()
Ejemplo n.º 3
0
 def on_kombu_message(self, body, message):
     logger.debug("received kombu message %r", body)
     event = Event.deserialize(body)
     try:
         self.container.handle_event(event)
     except:
         raise
     else:
         message.ack()
Ejemplo n.º 4
0
 def on_kombu_message(self, body, message):
     logger.debug("received kombu message %r", body)
     event = Event.deserialize(body)
     try:
         self.container.handle_event(event)
     except:
         raise
     else:
         message.ack()
Ejemplo n.º 5
0
 def _handle_message(self, body, message):
     try:
         event = Event.deserialize(body)
         self.handler(event)
         message.ack()
     except:
         self._handle_fail(message, event)
     finally:
         if self.handler.once:
             self.event_system.unsubscribe(self.handler)
Ejemplo n.º 6
0
 def _handle_message(self, body, message):
     try:
         event = Event.deserialize(body)
         self.handler(event)
         message.ack()
     except:
         self._handle_fail(message, event)
     finally:
         if self.handler.once:
             self.event_system.unsubscribe(self.handler)
Ejemplo n.º 7
0
 def _handle_message(self, body, message):
     try:
         event = Event.deserialize(body)
         self.handler(event)
         message.ack()
     except:
         logger.exception('failed to handle event from queue %r', self.handler.queue_name)
         # FIXME: add requeue support here. Make sure what we don't requeue
         # forever.
         message.reject()
         self.event_system.container.error_hook(sys.exc_info())
     finally:
         if self.handler.once:
             self.event_system.unsubscribe(self.handler)
Ejemplo n.º 8
0
 def message_handler():
     try:
         event = Event.deserialize(body)
         self.handler(event)
         message.ack()
     except:
         logger.exception('failed to handle event from queue %r', self.handler.queue_name)
         # FIXME: add requeue support here
         message.reject()
         # Since the message handler can be run sequentially, we are catching all exception
         # and reporting them here.
         self.event_system.container.error_hook(sys.exc_info())
     finally:
         if self.handler.once:
             self.event_system.unsubscribe(self.handler)
Ejemplo n.º 9
0
Archivo: kombu.py Proyecto: torte/lymph
 def _handle_message(self, body, message):
     try:
         event = Event.deserialize(body)
         self.handler(event)
         message.ack()
     except:
         logger.exception('failed to handle event from queue %r',
                          self.handler.queue_name)
         # FIXME: add requeue support here. Make sure what we don't requeue
         # forever.
         message.reject()
         self.event_system.container.error_hook(sys.exc_info())
     finally:
         if self.handler.once:
             self.event_system.unsubscribe(self.handler)
Ejemplo n.º 10
0
 def message_handler():
     try:
         event = Event.deserialize(body)
         self.handler(event)
         message.ack()
     except:
         logger.exception('failed to handle event from queue %r',
                          self.handler.queue_name)
         # FIXME: add requeue support here
         message.reject()
         # Since the message handler can be run sequentially, we are catching all exception
         # and reporting them here.
         self.event_system.container.error_hook(sys.exc_info())
     finally:
         if self.handler.once:
             self.event_system.unsubscribe(self.handler)
Ejemplo n.º 11
0
 def _consume(interface, event):
     self.consumer_func(self.interface, Event.deserialize(event['event']))
Ejemplo n.º 12
0
 def _consume(interface, event):
     self.consumer_func(self.interface,
                        Event.deserialize(event['event']))
Ejemplo n.º 13
0
 def _consume(self, consumer, container, event_type):
     for event in consumer:
         event = Event.deserialize(json.loads(event.message.value))
         container.handle_event(event)