Interface NotificationHandlerRegistry
-
- All Known Subinterfaces:
NotificationHandlerRegistration
public interface NotificationHandlerRegistryThe NotificationHandlerRegistry is used to register and unregister notification handlers. Notification handlers are registered against aPathAddress. The source PathAddress can be a pattern if at least one of its element value is a wildcard (PathElement.getValue()is*). For example:/subsystem=messaging/hornetq-server=default/jms-queue=*is an address pattern./subsystem=messaging/hornetq-server=*/jms-queue=*is an address pattern./subsystem=messaging/hornetq-server=default/jms-queue=myQueueis not an address pattern.
- Author:
- Jeff Mesnil (c) 2014 Red Hat inc.
-
-
Field Summary
Fields Modifier and Type Field Description static PathAddressANY_ADDRESSSpecial path address to register a notification handler for any source.static NullaryServiceDescriptor<NotificationHandlerRegistry>SERVICE_DESCRIPTOR
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidregisterNotificationHandler(PathAddress source, NotificationHandler handler, NotificationFilter filter)Register the given NotificationHandler to receive notifications emitted by the resource at the given source address.voidunregisterNotificationHandler(PathAddress source, NotificationHandler handler, NotificationFilter filter)Unregister the given NotificationHandler to stop receiving notifications emitted by the resource at the given source address.
-
-
-
Field Detail
-
SERVICE_DESCRIPTOR
static final NullaryServiceDescriptor<NotificationHandlerRegistry> SERVICE_DESCRIPTOR
-
ANY_ADDRESS
static final PathAddress ANY_ADDRESS
Special path address to register a notification handler for any source. A handler registered with this address will receive all notifications emitted by any source. It is advised to use a suitableNotificationFilterto constrain the received notifications (e.g. by their types).
-
-
Method Detail
-
registerNotificationHandler
void registerNotificationHandler(PathAddress source, NotificationHandler handler, NotificationFilter filter)
Register the given NotificationHandler to receive notifications emitted by the resource at the given source address. TheNotificationHandler.handleNotification(Notification)method will only be called on the registered handler if the filter'sNotificationFilter.isNotificationEnabled(Notification)returnstruefor the given notification.- Parameters:
source- the path address of the resource that emit notifications.handler- the notification handlerfilter- the notification filter. UseNotificationFilter.ALLto let the handler always handle notifications
-
unregisterNotificationHandler
void unregisterNotificationHandler(PathAddress source, NotificationHandler handler, NotificationFilter filter)
Unregister the given NotificationHandler to stop receiving notifications emitted by the resource at the given source address. The source, handler and filter must match the values that were used during registration to be effectively unregistered.- Parameters:
source- the path address of the resource that emit notifications.handler- the notification handlerfilter- the notification filter
-
-