Package net.engio.mbassy.bus
Class MBassador<T>
java.lang.Object
net.engio.mbassy.bus.AbstractPubSubSupport<T>
net.engio.mbassy.bus.AbstractSyncAsyncMessageBus<T,SyncAsyncPostCommand<T>>
net.engio.mbassy.bus.MBassador<T>
- All Implemented Interfaces:
ErrorHandlingSupport
,GenericMessagePublicationSupport<T,
,SyncAsyncPostCommand<T>> IMessageBus<T,
,SyncAsyncPostCommand<T>> PubSubSupport<T>
,RuntimeProvider
public class MBassador<T>
extends AbstractSyncAsyncMessageBus<T,SyncAsyncPostCommand<T>>
implements IMessageBus<T,SyncAsyncPostCommand<T>>
-
Field Summary
Fields inherited from class net.engio.mbassy.bus.AbstractPubSubSupport
ERROR_HANDLER_MSG
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor using default setup.MBassador
(IBusConfiguration configuration) Construct with fully specified configurationMBassador
(IPublicationErrorHandler errorHandler) Construct with default settings and specified publication error handler -
Method Summary
Modifier and TypeMethodDescriptionPublish a message to the bus using on of its supported message publication mechanisms.Synchronously publish a message to all registered listeners (this includes listeners defined for super types) The call blocks until every messageHandler has processed the message.publishAsync
(T message) publishAsync
(T message, long timeout, TimeUnit unit) Methods inherited from class net.engio.mbassy.bus.AbstractSyncAsyncMessageBus
addAsynchronousPublication, addAsynchronousPublication, finalize, hasPendingMessages, shutdown
Methods inherited from class net.engio.mbassy.bus.AbstractPubSubSupport
createMessagePublication, getPublicationFactory, getRegisteredErrorHandlers, getRuntime, getSubscriptionsByMessageType, handlePublicationError, subscribe, toString, unsubscribe
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.engio.mbassy.bus.common.ErrorHandlingSupport
getRegisteredErrorHandlers
Methods inherited from interface net.engio.mbassy.bus.common.IMessageBus
hasPendingMessages, shutdown
Methods inherited from interface net.engio.mbassy.bus.common.PubSubSupport
subscribe, unsubscribe
Methods inherited from interface net.engio.mbassy.bus.common.RuntimeProvider
getRuntime
-
Constructor Details
-
MBassador
public MBassador()Default constructor using default setup. super() will also add a default publication error logger -
MBassador
Construct with default settings and specified publication error handler- Parameters:
errorHandler
-
-
MBassador
Construct with fully specified configuration- Parameters:
configuration
-
-
-
Method Details
-
publishAsync
-
publishAsync
-
publish
Synchronously publish a message to all registered listeners (this includes listeners defined for super types) The call blocks until every messageHandler has processed the message.- Specified by:
publish
in interfacePubSubSupport<T>
- Parameters:
message
-
-
post
Description copied from interface:IMessageBus
Publish a message to the bus using on of its supported message publication mechanisms. The supported mechanisms depend on the available implementation and are exposed as subclasses of IPublicationCommand. The standard mechanism is the synchronous dispatch which will publish the message in the current thread and returns after every matching handler has been invoked.- Specified by:
post
in interfaceGenericMessagePublicationSupport<T,
SyncAsyncPostCommand<T>> - Specified by:
post
in interfaceIMessageBus<T,
SyncAsyncPostCommand<T>> - Parameters:
message
- - Any subtype of T welcome- Returns:
- An object that provides access to the available publication methods supported by the message bus.
-