summaryrefslogtreecommitdiff
path: root/oslo_messaging/notify/listener.py
diff options
context:
space:
mode:
Diffstat (limited to 'oslo_messaging/notify/listener.py')
-rw-r--r--oslo_messaging/notify/listener.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/oslo_messaging/notify/listener.py b/oslo_messaging/notify/listener.py
index a1586dd..1aa4613 100644
--- a/oslo_messaging/notify/listener.py
+++ b/oslo_messaging/notify/listener.py
@@ -40,14 +40,19 @@ and eventlet executors available.
A simple example of a notification listener with multiple endpoints might be::
- from oslo.config import cfg
+ from oslo_config import cfg
import oslo_messaging
class NotificationEndpoint(object):
+ filter_rule = NotificationFilter(publisher_id='^compute.*')
+
def warn(self, ctxt, publisher_id, event_type, payload, metadata):
do_something(payload)
class ErrorEndpoint(object):
+ filter_rule = NotificationFilter(event_type='^instance\..*\.start$',
+ context={'ctxt_key': 'regexp'})
+
def error(self, ctxt, publisher_id, event_type, payload, metadata):
do_something(payload)
@@ -69,7 +74,8 @@ A simple example of a notification listener with multiple endpoints might be::
A notifier sends a notification on a topic with a priority, the notification
listener will receive this notification if the topic of this one have been set
in one of the targets and if an endpoint implements the method named like the
-priority
+priority and if the notification match the NotificationFilter rule set into
+the filter_rule attribute of the endpoint.
Parameters to endpoint methods are the request context supplied by the client,
the publisher_id of the notification message, the event_type, the payload and