Class MessageBusBuilder


  • public final class MessageBusBuilder
    extends Object
    The MessageBusBuilder class provides a fluent interface to create and configure a MessageBus.

    Most of the configurable properties have default values set by the builder. Per default a synchronous MessageBus is created with an exception handler, that throws exception once they occur. The default MessageBusChannelFactory creates synchronous class specific Channels.

    See Also:
    EventMaid Documentation
    • Constructor Detail

      • MessageBusBuilder

        public MessageBusBuilder()
    • Method Detail

      • aMessageBus

        public static MessageBusBuilder aMessageBus()
        Creates a new MessageBusBuilder.
        Returns:
        a new MessageBusBuilder.
      • forType

        public MessageBusBuilder forType​(MessageBusType type)
        Overrides the MessageBusType. Per default MessageBusType.SYNCHRONOUS is configured.
        Parameters:
        type - the MessageBusType to overwrite
        Returns:
        the same MessageBusBuilder instance the method was called one
      • withAChannelFactory

        public MessageBusBuilder withAChannelFactory​(MessageBusChannelFactory channelFactory)
        Overrides the the MessageBusChannelFactory.
        Parameters:
        channelFactory - the new MessageBusChannelFactory.
        Returns:
        the same MessageBusBuilder instance the method was called one
      • withAsynchronousConfiguration

        public MessageBusBuilder withAsynchronousConfiguration​(AsynchronousConfiguration asynchronousConfiguration)
        In case an asynchronous MessageBus is created an AsynchronousConfiguration has to be provides with this method.
        Parameters:
        asynchronousConfiguration - the required AsynchronousConfiguration
        Returns:
        the same MessageBusBuilder instance the method was called one
      • withExceptionHandler

        public MessageBusBuilder withExceptionHandler​(MessageBusExceptionHandler exceptionHandler)
        Overrides the default exception throwing MessageBusExceptionHandler.
        Parameters:
        exceptionHandler - the new MessageBusExceptionHandler
        Returns:
        the same MessageBusBuilder instance the method was called one
      • build

        public MessageBus build()
        Creates the MessageBus
        Returns:
        the newly created MessageBus