Class MessageBusBuilder
- java.lang.Object
-
- de.quantummaid.eventmaid.messageBus.MessageBusBuilder
-
public final class MessageBusBuilder extends Object
TheMessageBusBuilderclass provides a fluent interface to create and configure aMessageBus.Most of the configurable properties have default values set by the builder. Per default a synchronous
MessageBusis created with an exception handler, that throws exception once they occur. The defaultMessageBusChannelFactorycreates synchronous class specificChannels.- See Also:
- EventMaid Documentation
-
-
Constructor Summary
Constructors Constructor Description MessageBusBuilder()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static MessageBusBuilderaMessageBus()Creates a newMessageBusBuilder.MessageBusbuild()Creates theMessageBusMessageBusBuilderforType(MessageBusType type)Overrides theMessageBusType.MessageBusBuilderwithAChannelFactory(MessageBusChannelFactory channelFactory)Overrides the theMessageBusChannelFactory.MessageBusBuilderwithAsynchronousConfiguration(AsynchronousConfiguration asynchronousConfiguration)In case an asynchronousMessageBusis created anAsynchronousConfigurationhas to be provides with this method.MessageBusBuilderwithExceptionHandler(MessageBusExceptionHandler exceptionHandler)Overrides the default exception throwingMessageBusExceptionHandler.
-
-
-
Method Detail
-
aMessageBus
public static MessageBusBuilder aMessageBus()
Creates a newMessageBusBuilder.- Returns:
- a new
MessageBusBuilder.
-
forType
public MessageBusBuilder forType(MessageBusType type)
Overrides theMessageBusType. Per defaultMessageBusType.SYNCHRONOUSis configured.- Parameters:
type- theMessageBusTypeto overwrite- Returns:
- the same
MessageBusBuilderinstance the method was called one
-
withAChannelFactory
public MessageBusBuilder withAChannelFactory(MessageBusChannelFactory channelFactory)
Overrides the theMessageBusChannelFactory.- Parameters:
channelFactory- the newMessageBusChannelFactory.- Returns:
- the same
MessageBusBuilderinstance the method was called one
-
withAsynchronousConfiguration
public MessageBusBuilder withAsynchronousConfiguration(AsynchronousConfiguration asynchronousConfiguration)
In case an asynchronousMessageBusis created anAsynchronousConfigurationhas to be provides with this method.- Parameters:
asynchronousConfiguration- the requiredAsynchronousConfiguration- Returns:
- the same
MessageBusBuilderinstance the method was called one
-
withExceptionHandler
public MessageBusBuilder withExceptionHandler(MessageBusExceptionHandler exceptionHandler)
Overrides the default exception throwingMessageBusExceptionHandler.- Parameters:
exceptionHandler- the newMessageBusExceptionHandler- Returns:
- the same
MessageBusBuilderinstance the method was called one
-
build
public MessageBus build()
Creates theMessageBus- Returns:
- the newly created
MessageBus
-
-