Make the dispatcher responsible of the message ack
This patch make the dispatcher responsible of the message acknowledgement. This is the preliminar step to be able to requeue message. Partial implements blueprint notification-subscriber-server Change-Id: If74b47d5e23976d407deb27df7395b1982963c75
This commit is contained in:
parent
8a644c1166
commit
e785a5d994
@ -90,9 +90,7 @@ class AMQPListener(base.Listener):
|
|||||||
def poll(self):
|
def poll(self):
|
||||||
while True:
|
while True:
|
||||||
if self.incoming:
|
if self.incoming:
|
||||||
message = self.incoming.pop(0)
|
return self.incoming.pop(0)
|
||||||
message.acknowledge()
|
|
||||||
return message
|
|
||||||
self.conn.consume(limit=1)
|
self.conn.consume(limit=1)
|
||||||
|
|
||||||
|
|
||||||
|
@ -60,6 +60,7 @@ class NotificationDispatcher(object):
|
|||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
def __call__(self, incoming):
|
def __call__(self, incoming):
|
||||||
yield lambda: self._dispatch_and_handle_error(incoming)
|
yield lambda: self._dispatch_and_handle_error(incoming)
|
||||||
|
incoming.acknowledge()
|
||||||
|
|
||||||
def _dispatch_and_handle_error(self, incoming):
|
def _dispatch_and_handle_error(self, incoming):
|
||||||
"""Dispatch a notification message to the appropriate endpoint method.
|
"""Dispatch a notification message to the appropriate endpoint method.
|
||||||
|
@ -124,6 +124,7 @@ class RPCDispatcher(object):
|
|||||||
|
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
def __call__(self, incoming):
|
def __call__(self, incoming):
|
||||||
|
incoming.acknowledge()
|
||||||
yield lambda: self._dispatch_and_reply(incoming)
|
yield lambda: self._dispatch_and_reply(incoming)
|
||||||
|
|
||||||
def _dispatch_and_reply(self, incoming):
|
def _dispatch_and_reply(self, incoming):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user