|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
E - Event type.P - Handler priority type.C - Context type for extractors.K - Event bus objects (handlers, events) ID type.H - Handle type.S - Event store type.public interface EventBus<E,P extends Comparable<P>,C,K,H extends EventBus.Handle<E,P,C>,S extends EventStore<E,P,C,H,S>>
Event bus asynchronously dispatches events to registered handlers.
| Nested Class Summary | |
|---|---|
static interface |
EventBus.Handle<E,P extends Comparable<P>,C>
The primary purpose of Handle in the event bus is to be a synchronization object. |
| Method Summary | |
|---|---|
K |
addHandler(EventHandler<E,P,C,H,S> eventHandler)
Registers event handler with a predicate. |
Collection<Derivation<E,P,C>> |
getDerivations(E event)
|
Class<E> |
getEventType()
|
ExceptionHandler |
getExceptionHandler()
|
InferencePolicy |
getInferencePolicy()
|
S |
getStore()
|
void |
manageHandlers(Matcher.HandlerManager<E,P,C,K,H,S> handlerManager)
This method is used for batch live updates of bus handlers. |
H |
post(E event,
Posts event to the bus. |
void |
remove(E event)
Removes event from the bus. |
void |
removeHandlers(Iterable<K> keys)
Removes registered handler(s). |
void |
removeHandlers(K... keys)
Removes registered handler(s). |
void |
reset()
Clears join collections and handle map. |
void |
setExceptionHandler(ExceptionHandler exceptionHandler)
|
| Method Detail |
|---|
Class<E> getEventType()
InferencePolicy getInferencePolicy()
void setExceptionHandler(ExceptionHandler exceptionHandler)
ExceptionHandler getExceptionHandler()
K addHandler(EventHandler<E,P,C,H,S> eventHandler)
eventHandler - Event handler.oneOff - if true, event handler fires only once and the gets removed from the
bus.predicate - Predicates. The handler is invoked only if predicate evaluates to true. If there is more then one
predicate, CommutativeAnd is constructed from predicates.
void removeHandlers(K... keys)
void removeHandlers(Iterable<K> keys)
H post(E event,
... validators)
event - Event to dispatch to handlers.validators - Predicate(s) which are checked when object is retrieved from the event store.
If there is more than one predicate, predicates are connected with AND. If validator(s) evaluate to
false, the object handle is considered invalid, i.e. object is considered removed from the store.
Once validator(s) evaluate to false, they shall always evaluate to false. One of use of validators
can be to expire object in the store, i.e. after some time validator returns false and object is cleared
from the database. If validators evaluate to false at put time, object is not put to the store and
put() returns null. Validators evaluation result is not cached.
void reset()
Collection<Derivation<E,P,C>> getDerivations(E event)
event -
S getStore()
void remove(E event)
event - void manageHandlers(Matcher.HandlerManager<E,P,C,K,H,S> handlerManager)
busManager -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||