[openstack-dev] [oslo.messaging] extending notification MessagingDriver

Doug Hellmann doug at doughellmann.com
Thu Feb 26 20:55:42 UTC 2015



On Thu, Feb 26, 2015, at 01:41 PM, Boden Russell wrote:
> Thanks for filing the bug report...
> 
> My driver implementation effectively allows you to filter on
> notification events and multicast matches to a given list of topics.
> 
> I've been calling it an messaging multicast notification driver and thus
> the plugin stevedore entry point I've called 'messaging-multicast'.
> 
> The impl basically wraps the oslo messaging driver and does it's
> matching and multicasting after the parent... e.g.
> 
> def notify(self, ctxt, msg, priority, retry):
>     _notify = super(AMQPMulticastDriver, self).notify(
>         ctxt, msg, priority, retry)
> 
>     # check filters on msg and priority and notify on configured topics
>     # for any matches below
>     ... code ...
> 
>     return _notify
> 
> 
> The driver is a drop-in replacement anywhere oslo.messaging is used for
> notifications and accepts some conf props to set it up.

The notification drivers config option supports multiple values, so you
don't need to subclass in order to make that work. You could implement a
completely separate driver that does different notifications than the
built-in version. Of course, we should probably make that base class
public but you don't have to actually subclass it for your driver to
work AFAICT.

You might also want to look at the existing RoutingDriver. It does not
do quite what you want, but some of the concepts might be useful. It
would be useful to be able to compose the routing notifier with other
notifiers to do the sort of thing you're talking about without having to
build a custom driver.

> 
> example config for usage (glance in this example):
> 
> 	rpc_backend = rabbit
>         ...
>         notification_driver = messaging-multicast
>         multicast_events = image.upload,image.delete
>         multicast_topic_prefix = glance.multicast.
>         publisher_id = GLANCE:MASTER
>         image.delete = host1,host2
>         image.upload = host1,host2
> 
> 
> The above will send a copy of image.delete and image.upload events to
> the glance.multicast.host1 and glance.multicast.host2 topics. It will
> use 'GLANCE:MASTER' as the publisher ID in the multicasted events.
> 
> Your feedback is appreciated.
> 
> 
> >> On Thu, Feb 26, 2015, at 07:24 AM, Boden Russell wrote:
> >> What's the suggested approach for implementing a custom oslo messaging
> >> driver given the existing impl [1] is "private"?
> >> [1] http://goo.gl/cRGNwJ
> >>
> > On 2/26/15 10:33 AM, Doug Hellmann wrote:
> > Yes, I don't recommend relying on anything in private modules. It looks
> > like even the base class for the notification drivers is private, right
> > now. We should probably change that, so I filed
> > https://bugs.launchpad.net/oslo.messaging/+bug/1426046.
> > 
> > Maybe if you can give more details about what your driver wants to do, I
> > can provide better feedback about a short-term approach for you.
> 
> 
> __________________________________________________________________________
> OpenStack Development Mailing List (not for usage questions)
> Unsubscribe:
> OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev



More information about the OpenStack-dev mailing list