MulticastBus

public abstract class MulticastBus<M extends Signal<?, ?, ?>, E extends SignalEnvelope<? extends Object, M, ? extends Object>, C extends MessageClass<? extends Message>, D extends MessageDispatcher<C, E>> extends Bus<T, E, C, D>

A Bus, which delivers a single message to multiple dispatchers.

Parameters

<M>

the type of outer objects (containing messages of interest) that are posted to the bus

<E>

the type of envelopes for outer objects used by this bus

<C>

the type of message class

<D>

the type of dispatches used by this bus

Inheritors

Constructors

Link copied to clipboard
protected void MulticastBus(BusBuilder<? extends Object, M, E, C, D> builder)

Functions

Link copied to clipboard
protected int callDispatchers(E messageEnvelope)
Call the dispatchers for the messageEnvelope.
Link copied to clipboard
protected final void onDispatched(SignalId signal)
Called after the dispatching of the signal to all of the target dispatchers has been completed.
Link copied to clipboard
protected final void onDispatchingStarted(SignalId signal)
Called before the dispatching of the signal with the passed ID is started.

Inherited functions

Link copied to clipboard
public void checkOpen()
Ensures that the object is open.
Link copied to clipboard
public void close()
Closes the filters of this bus and unregisters all the dispatchers.
public abstract void close()
Link copied to clipboard
protected abstract DeadMessageHandler<E> deadMessageHandler()
Obtains the instance of DeadMessageHandler for this bus.
Link copied to clipboard
protected abstract void dispatch(E envelope)
Passes the given envelope for dispatching.
Link copied to clipboard
public boolean hasFilter(BusFilter<E> filter)
Link copied to clipboard
public boolean hasListener(Listener<E> listener)
Link copied to clipboard
public final boolean isOpen()
Tells if this bus can accept messages for posting.
Link copied to clipboard
public final void post(T message, StreamObserver<Ack> observer)
Posts the message to the bus.
public final void post(Iterable<T> messages, StreamObserver<Ack> observer)
Posts the given messages to the bus.
Link copied to clipboard
protected StreamObserver<Ack> prepareObserver(Iterable<T> messages, StreamObserver<Ack> source)
Prepares the given StreamObserver to post messages into this bus.
Link copied to clipboard
public void register(D dispatcher)
Registers the passed dispatcher.
Link copied to clipboard
protected DispatcherRegistry<C, E, D> registry()
Obtains the dispatcher registry.
Link copied to clipboard
A callback for derived classes to modify the order of filters used by the bus.
Link copied to clipboard
protected abstract void store(Iterable<T> messages)
Stores the given messages into the underlying storage.
Link copied to clipboard
protected abstract E toEnvelope(T message)
Packs the given message of type T into an envelope of type E.
Link copied to clipboard
public void unregister(D dispatcher)
Unregisters dispatching for message classes of the passed dispatcher.
Link copied to clipboard
protected abstract EnvelopeValidator<E> validator()
Obtains the instance of EnvelopeValidator for this bus.