public abstract class AbstractEventBus extends Object implements EventBus
 This implementation of the EventBus directly forwards all published events (in the callers' thread) to
 subscribed event processors.
| Modifier and Type | Class and Description | 
|---|---|
static class  | 
AbstractEventBus.Builder
Abstract Builder class to instantiate  
AbstractEventBus implementations. | 
| Modifier | Constructor and Description | 
|---|---|
protected  | 
AbstractEventBus(AbstractEventBus.Builder builder)
Instantiate an  
AbstractEventBus based on the fields contained in the AbstractEventBus.Builder. | 
| Modifier and Type | Method and Description | 
|---|---|
protected void | 
afterCommit(List<? extends EventMessage<?>> events)
Process given  
events after the Unit of Work has been committed. | 
protected void | 
commit(List<? extends EventMessage<?>> events)
Process given  
events while the Unit of Work root is being committed. | 
protected List<? extends EventMessage<?>> | 
intercept(List<? extends EventMessage<?>> events)
Invokes all the dispatch interceptors. 
 | 
protected void | 
prepareCommit(List<? extends EventMessage<?>> events)
Process given  
events while the Unit of Work root is preparing for commit. | 
void | 
publish(List<? extends EventMessage<?>> events)
Publish a collection of events on this bus (one, or multiple). 
 | 
protected List<EventMessage<?>> | 
queuedMessages()
Returns a list of all the events staged for publication in this Unit of Work. 
 | 
Registration | 
registerDispatchInterceptor(MessageDispatchInterceptor<? super EventMessage<?>> dispatchInterceptor)
Register the given DispatchInterceptor. 
 | 
Registration | 
subscribe(Consumer<List<? extends EventMessage<?>>> eventProcessor)
Subscribe the given  
messageProcessor to this message source. | 
protected AbstractEventBus(AbstractEventBus.Builder builder)
AbstractEventBus based on the fields contained in the AbstractEventBus.Builder.builder - the AbstractEventBus.Builder used to instantiate an AbstractEventBus instancepublic Registration subscribe(@Nonnull Consumer<List<? extends EventMessage<?>>> eventProcessor)
SubscribableMessageSourcemessageProcessor to this message source. When subscribed, it will receive all
 messages published to this source.
 
 If the given messageProcessor is already subscribed, nothing happens.
subscribe in interface SubscribableMessageSource<EventMessage<?>>eventProcessor - The message processor to subscribemessageProcessor. When unsubscribed it will no longer receive
 messages.public Registration registerDispatchInterceptor(@Nonnull MessageDispatchInterceptor<? super EventMessage<?>> dispatchInterceptor)
preprocessor is not invoked by this Event Bus until the Unit of
 Work root is committed.registerDispatchInterceptor in interface MessageDispatchInterceptorSupport<EventMessage<?>>dispatchInterceptor - public void publish(@Nonnull List<? extends EventMessage<?>> events)
EventBus
 Implementations may treat the given events as a single batch and distribute the events as such to all
 subscribed EventListeners.
protected List<EventMessage<?>> queuedMessages()
protected List<? extends EventMessage<?>> intercept(List<? extends EventMessage<?>> events)
events - The original events being publishedprotected void prepareCommit(List<? extends EventMessage<?>> events)
events while the Unit of Work root is preparing for commit. The default implementation
 signals the registered MessageMonitor that the given events are ingested and passes the events to each
 registered event processor.events - Events to be published by this Event Busprotected void commit(List<? extends EventMessage<?>> events)
events while the Unit of Work root is being committed. The default implementation does
 nothing.events - Events to be published by this Event Busprotected void afterCommit(List<? extends EventMessage<?>> events)
events after the Unit of Work has been committed. The default implementation does nothing.events - Events to be published by this Event BusCopyright © 2010–2023. All rights reserved.