can oslo_messaging support basic.return

Bug #1776492 reported by JiaJunsu
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oslo.messaging
Confirmed
Wishlist
Unassigned

Bug Description

Consider a scenario like this: A want to send a message to B, when the message reach at the broker, B hasn't create the queue to receive message. I found the broker just drop the message and "basic.publish" sucessed.

The amqp protocol has defined “basic.return” to address such cases. Can oslo_messaging support this?

Revision history for this message
Ken Giusti (kgiusti) wrote :

This is an interesting idea, however the kombu library (which oslo.messaging uses to interface with rabbitmq) does not currently support basic.return. The 'immediate' and 'mandatory' flags are not implemented:

See: https://github.com/celery/kombu/blob/master/kombu/messaging.py#L129

I did try to set those flags on publish - just to see what happens:

File "oslo_messaging/_drivers/impl_rabbit.py", line 807, in ensure
    ret, channel = autoretry_method()
  File "/home/kgiusti/work/openstack/oslo.messaging/.tox/py27/lib/python2.7/site-packages/kombu/connection.py", line 494, in _ensured
    return fun(*args, **kwargs)
  File "/home/kgiusti/work/openstack/oslo.messaging/.tox/py27/lib/python2.7/site-packages/kombu/connection.py", line 570, in __call__
    return fun(*args, channel=channels[0], **kwargs), channels[0]
  File "oslo_messaging/_drivers/impl_rabbit.py", line 795, in execute_method
    self._set_current_channel(channel)
  File "oslo_messaging/_drivers/impl_rabbit.py", line 852, in _set_current_channel
    on_return=my_bad)
  File "/home/kgiusti/work/openstack/oslo.messaging/.tox/py27/lib/python2.7/site-packages/kombu/messaging.py", line 77, in __init__
    self.revive(self._channel)
  File "/home/kgiusti/work/openstack/oslo.messaging/.tox/py27/lib/python2.7/site-packages/kombu/messaging.py", line 232, in revive
    self._channel.events['basic_return'].add(self.on_return)
AttributeError: 'Channel' object has no attribute 'events'

So yeah - it isn't supported.

If the kombu project did decide to provide this we could try using it in oslo.messaging, but for now we can't.

Changed in oslo.messaging:
status: New → Confirmed
importance: Undecided → Wishlist
Revision history for this message
Gabriele Santomaggio (gsantomaggio) wrote :

Kombu actually supports the mandatory flag.

@kgiusti the error you see in your tests is [1] ( I fixed it, now the tests work)

Mandatory flag can't be used on "memory" transport in kombu since "memory" transport does not follow AMQP protocol, see [2]

btw we are working on "mandatory" flag implementation, see [3],[4] and [5]

-
Gabriele Santomaggio
Cloud Developer @SUSE

1- https://github.com/celery/kombu/pull/1053
2- https://github.com/celery/kombu/issues/1050
3- https://blueprints.launchpad.net/oslo.messaging/+spec/transport-options
4- https://review.opendev.org/#/c/666241/
5- https://review.opendev.org/#/c/660373/

Revision history for this message
Gabriele Santomaggio (gsantomaggio) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.