Package net.engio.mbassy.dispatch
Class MessageDispatcher
- java.lang.Object
-
- net.engio.mbassy.subscription.AbstractSubscriptionContextAware
-
- net.engio.mbassy.dispatch.MessageDispatcher
-
- All Implemented Interfaces:
IMessageDispatcher
,ISubscriptionContextAware
public class MessageDispatcher extends AbstractSubscriptionContextAware implements IMessageDispatcher
Standard implementation for direct, unfiltered message delivery. For each message delivery, this dispatcher iterates over the listeners and uses the previously provided handler invocation to deliver the message to each listener
-
-
Field Summary
Fields Modifier and Type Field Description private IHandlerInvocation
invocation
-
Constructor Summary
Constructors Constructor Description MessageDispatcher(SubscriptionContext context, IHandlerInvocation invocation)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dispatch(MessagePublication publication, java.lang.Object message, java.lang.Iterable listeners)
Delivers the given message to the given set of listeners.IHandlerInvocation
getInvocation()
Get the handler invocation that will be used to deliver the message to each listener.-
Methods inherited from class net.engio.mbassy.subscription.AbstractSubscriptionContextAware
getContext
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.engio.mbassy.subscription.ISubscriptionContextAware
getContext
-
-
-
-
Field Detail
-
invocation
private final IHandlerInvocation invocation
-
-
Constructor Detail
-
MessageDispatcher
public MessageDispatcher(SubscriptionContext context, IHandlerInvocation invocation)
-
-
Method Detail
-
dispatch
public void dispatch(MessagePublication publication, java.lang.Object message, java.lang.Iterable listeners)
Description copied from interface:IMessageDispatcher
Delivers the given message to the given set of listeners. Delivery may be delayed, aborted or restricted in various ways, depending on the configuration of the dispatcher- Specified by:
dispatch
in interfaceIMessageDispatcher
- Parameters:
publication
- The message publication that initiated the dispatchmessage
- The message that should be delivered to the listenerslisteners
- The listeners that should receive the message
-
getInvocation
public IHandlerInvocation getInvocation()
Description copied from interface:IMessageDispatcher
Get the handler invocation that will be used to deliver the message to each listener.- Specified by:
getInvocation
in interfaceIMessageDispatcher
- Returns:
- the handler invocation that will be used to deliver the message to each listener
-
-