public class NotificationHelper extends Object
ServerNotificationHandler.
When the notification is to be sent on the context of the processing of a Event (meaning, the method used to fire the
notification takes a Event argument), then this instance will delegate into a ServerNotificationHandler that
corresponds to the MuleContext of that event. When the notification does not relate to a particular Event (for
example, connection/reconnection/disconnection events), then a defaultNotificationHandler will be used| Constructor and Description |
|---|
NotificationHelper(ServerNotificationHandler defaultNotificationHandler,
Class<? extends ServerNotification> notificationClass,
boolean dynamicNotifications)
Creates a new
NotificationHelper that emits instances of notificationClass class. |
| Modifier and Type | Method and Description |
|---|---|
void |
fireNotification(Object source,
Event event,
FlowConstruct flowConstruct,
int action)
Fires a
ConnectorMessageNotification for the given arguments using the ServerNotificationHandler associated
to the given event and based on a ComponentLocation. |
void |
fireNotification(ServerNotification notification)
Fires the given
notification using the defaultNotificationHandler. |
void |
fireNotification(ServerNotification notification,
MuleContext muleContext)
Fires the given
notification using the ServerNotificationHandler that corresponds to the given event |
boolean |
isNotificationEnabled()
Checks if the
defaultNotificationHandler is enabled to fire instances of notificationClass. |
boolean |
isNotificationEnabled(MuleContext muleContext)
Checks if the
ServerNotificationHandler associated to the given event is enabled to fire instances of
notificationClass |
public NotificationHelper(ServerNotificationHandler defaultNotificationHandler, Class<? extends ServerNotification> notificationClass, boolean dynamicNotifications)
NotificationHelper that emits instances of notificationClass class.defaultNotificationHandler - The ServerNotificationHandler to be used on notifications which don't relate to a
EventnotificationClass - The Class of the notifications to be fired by this helperdynamicNotifications - If true, notifications will be fired directly to a ServerNotificationHandler
responsible to decide to emit it or not. If false the notification will be checked to be enable or not at
creation timepublic boolean isNotificationEnabled()
defaultNotificationHandler is enabled to fire instances of notificationClass. Use this method
when planning to fire a notification that is not related to a Event (connect/disconnect/etc). Otherwise, use
#isNotificationEnabled(Event) insteadtrue if defaultNotificationHandler is enabled for notificationClasspublic boolean isNotificationEnabled(MuleContext muleContext)
ServerNotificationHandler associated to the given event is enabled to fire instances of
notificationClassmuleContext - the Mule node.true if there is a ServerNotificationHandler enabled for notificationClasspublic void fireNotification(Object source, Event event, FlowConstruct flowConstruct, int action)
ConnectorMessageNotification for the given arguments using the ServerNotificationHandler associated
to the given event and based on a ComponentLocation.source - event - a EventflowConstruct - the FlowConstruct that generated the notificationaction - the action code for the notificationpublic void fireNotification(ServerNotification notification)
notification using the defaultNotificationHandler. Use this method when the
notification is not related to any Event (for example, connect/disconnect/etc). Otherwise, use
#fireNotification(ServerNotification, Event) insteadnotification - a ServerNotificationpublic void fireNotification(ServerNotification notification, MuleContext muleContext)
notification using the ServerNotificationHandler that corresponds to the given eventnotification - a ServerNotificationmuleContext - the Mule node.Copyright © 2003–2017 MuleSoft, Inc.. All rights reserved.