Beispiel #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)
Beispiel #2
0
 def message_handler():
     event = Event.deserialize(body)
     try:
         self.handler(event)
     except:
         raise
     else:
         message.ack()
Beispiel #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()
Beispiel #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()
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #9
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)
Beispiel #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)
Beispiel #11
0
 def _consume(interface, event):
     self.consumer_func(self.interface, Event.deserialize(event['event']))
Beispiel #12
0
 def _consume(interface, event):
     self.consumer_func(self.interface,
                        Event.deserialize(event['event']))
Beispiel #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)