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
Constructors Constructor Description MBassador()
Default 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SyncAsyncPostCommand<T>
post(T message)
Publish a message to the bus using on of its supported message publication mechanisms.IMessagePublication
publish(T message)
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.IMessagePublication
publishAsync(T message)
IMessagePublication
publishAsync(T message, long timeout, java.util.concurrent.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 Detail
-
MBassador
public MBassador()
Default constructor using default setup. super() will also add a default publication error logger
-
MBassador
public MBassador(IPublicationErrorHandler errorHandler)
Construct with default settings and specified publication error handler- Parameters:
errorHandler
-
-
MBassador
public MBassador(IBusConfiguration configuration)
Construct with fully specified configuration- Parameters:
configuration
-
-
-
Method Detail
-
publishAsync
public IMessagePublication publishAsync(T message)
-
publishAsync
public IMessagePublication publishAsync(T message, long timeout, java.util.concurrent.TimeUnit unit)
-
publish
public IMessagePublication publish(T message)
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
public SyncAsyncPostCommand<T> post(T message)
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.
-
-