Package net.engio.mbassy.bus
Class SyncMessageBus<T>
java.lang.Object
net.engio.mbassy.bus.AbstractPubSubSupport<T>
net.engio.mbassy.bus.SyncMessageBus<T>
- All Implemented Interfaces:
ErrorHandlingSupport
,GenericMessagePublicationSupport<T,
,SyncMessageBus.SyncPostCommand> PubSubSupport<T>
,RuntimeProvider
public class SyncMessageBus<T>
extends AbstractPubSubSupport<T>
implements PubSubSupport<T>, ErrorHandlingSupport, GenericMessagePublicationSupport<T,SyncMessageBus.SyncPostCommand>
A message bus implementation that offers only synchronous message publication. Using this bus
will not create any new threads.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from class net.engio.mbassy.bus.AbstractPubSubSupport
ERROR_HANDLER_MSG
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor using default setup.SyncMessageBus
(IBusConfiguration configuration) Construct with fully specified configurationSyncMessageBus
(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.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, finalize, 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.PubSubSupport
subscribe, unsubscribe
Methods inherited from interface net.engio.mbassy.bus.common.RuntimeProvider
getRuntime
-
Constructor Details
-
SyncMessageBus
public SyncMessageBus()Default constructor using default setup. super() will also add a default publication error logger -
SyncMessageBus
Construct with default settings and specified publication error handler- Parameters:
errorHandler
-
-
SyncMessageBus
Construct with fully specified configuration- Parameters:
configuration
-
-
-
Method Details
-
publish
Description copied from interface:PubSubSupport
Synchronously publish a message to all registered listeners. This includes listeners defined for super types of the given message type, provided they are not configured to reject valid subtype. The call returns when all matching handlers of all registered listeners have been notified (invoked) of the message.- Specified by:
publish
in interfacePubSubSupport<T>
- Parameters:
message
-
-
post
Description copied from interface:GenericMessagePublicationSupport
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,
SyncMessageBus.SyncPostCommand> - Parameters:
message
- - Any subtype of T welcome- Returns:
- An object that provides access to the available publication methods supported by the message bus.
-