public class NotificationHelper extends Object
ServerNotificationHandler
.
When the notification is to be sent on the context of the processing of a MuleEvent
(meaning, the method used to fire the notification takes a MuleEvent
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
MuleEvent
(for example, connection/reconnection/disconnection events), then a
defaultNotificationHandler
will be usedConstructor 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(MuleEvent event,
String uri,
FlowConstruct flowConstruct,
int action)
Fires a
ConnectorMessageNotification for the given arguments
using the ServerNotificationHandler associated to the given event |
void |
fireNotification(MuleMessage message,
String uri,
FlowConstruct flowConstruct,
int action)
Deprecated.
as of 3.7.2. Use
fireNotification(MuleEvent, String, FlowConstruct, int) instead |
void |
fireNotification(ServerNotification notification)
Fires the given
notification using the defaultNotificationHandler . |
void |
fireNotification(ServerNotification notification,
MuleEvent event)
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(MuleEvent event)
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 MuleEvent
notificationClass
- 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 MuleEvent
(connect/disconnect/etc). Otherwise, use
isNotificationEnabled(MuleEvent)
insteadtrue
if defaultNotificationHandler
is enabled for notificationClass
public boolean isNotificationEnabled(MuleEvent event)
ServerNotificationHandler
associated to the given event
is enabled to fire instances of notificationClass
true
if there is a ServerNotificationHandler
enabled for notificationClass
@Deprecated public void fireNotification(MuleMessage message, String uri, FlowConstruct flowConstruct, int action)
fireNotification(MuleEvent, String, FlowConstruct, int)
insteadConnectorMessageNotification
for the given arguments
using the defaultNotificationHandler
message
- a MuleMessage
uri
- the uri of the firing endpointflowConstruct
- the FlowConstruct
that generated the notificationaction
- the action code for the notificationpublic void fireNotification(MuleEvent event, String uri, FlowConstruct flowConstruct, int action)
ConnectorMessageNotification
for the given arguments
using the ServerNotificationHandler
associated to the given event
event
- a MuleEvent
uri
- the uri of the firing endpointflowConstruct
- 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 MuleEvent
(for example, connect/disconnect/etc). Otherwise, use fireNotification(ServerNotification, MuleEvent)
insteadnotification
- a ServerNotification
public void fireNotification(ServerNotification notification, MuleEvent event)
notification
using the ServerNotificationHandler
that corresponds
to the given event
notification
- a ServerNotification
Copyright © 2003–2016 MuleSoft, Inc.. All rights reserved.