Interface MessageBus

    • Method Detail

      • unsubcribe

        void unsubcribe​(SubscriptionId subscriptionId)
        Removes all Subscribers with the given SubscriptionId
        Parameters:
        subscriptionId - the SubscriptionId to remove Subscribers
      • add

        void add​(Filter<Object> filter)
        Adds a Filter to the accepting Channel.
        Parameters:
        filter - the Filter to be added
      • add

        void add​(Filter<Object> filter,
                 int position)
        Adds the Filter to the accepting Channel
        Parameters:
        filter - the Filter to be added
        position - the position of the Filter
        Throws:
        ArrayIndexOutOfBoundsException - if the position is higher than the number of Filter or negative
      • getFilter

        List<Filter<Object>> getFilter()
        Returns all currently added Filters.
        Returns:
        all Filters
      • remove

        void remove​(Filter<Object> filter)
        Removes the given Filter.
        Parameters:
        filter - the Filter to remove
      • onException

        SubscriptionId onException​(EventType eventType,
                                   MessageBusExceptionListener exceptionListener)
        Adds a dynamic MessageBusExceptionListener for the messages with the EventType
        Parameters:
        eventType - the EventType to match
        exceptionListener - the MessageBusExceptionListener to add
        Returns:
        a SubscriptionId identifying exception listener
      • onException

        SubscriptionId onException​(CorrelationId correlationId,
                                   MessageBusExceptionListener exceptionListener)
        Adds a dynamic MessageBusExceptionListener for the messages matching the CorrelationId.
        Parameters:
        correlationId - the CorrelationId to match
        exceptionListener - the MessageBusExceptionListener to add
        Returns:
        a SubscriptionId identifying exception listener
      • unregisterExceptionListener

        void unregisterExceptionListener​(SubscriptionId subscriptionId)
        Removes all exceptionListener with the given SubscriptionId.
        Parameters:
        subscriptionId - the SubscriptionId to remove exception listener for
      • getStatusInformation

        MessageBusStatusInformation getStatusInformation()
        Removes the MessageBusStatusInformation interface, that allows querying statistics and Subscribers.
        Returns:
        the MessageBusStatusInformation interface
      • close

        void close​(boolean finishRemainingTasks)
        Closes the MessageBus.
        Parameters:
        finishRemainingTasks - when true, the MessageBus tries to deliver queued messages, otherwise they are discarded
      • awaitTermination

        boolean awaitTermination​(long timeout,
                                 TimeUnit unit)
                          throws InterruptedException
        Blocks the caller until all remaining tasks have completed execution after a close has been called, the timeout occurs or the current thread is interrupted.
        Parameters:
        timeout - the duration to wait
        unit - the time unit of the timeout
        Returns:
        true if this MessageBus terminated, false if the timeout elapsed before termination or false if close was not yet called
        Throws:
        InterruptedException - if interrupted while waiting
      • isClosed

        boolean isClosed()
        Returns true if close has been called on this MessageBus.
        Returns:
        true, if a close was already called, or false otherwise