Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.hammurapi.eventbus
Interface EventBus<E,P extends Comparable<P>,C,K,H extends EventBus.Handle<E,P,C>,S extends EventStore<E,P,C,H,S>>

Show UML class diagram

Type Parameters:
  `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.

All Known Implementing Classes:
  AbstractEventBus, LocalEventBus, LocalEventBusBase

    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, ... validators)` 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

### getEventType

    Class<E> getEventType()

### getInferencePolicy

    InferencePolicy getInferencePolicy()

### setExceptionHandler

    void setExceptionHandler(ExceptionHandler exceptionHandler)

### getExceptionHandler

    ExceptionHandler getExceptionHandler()

### addHandler

    K addHandler(EventHandler<E,P,C,H,S> eventHandler)

  Registers event handler with a predicate.

  Parameters:
    `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.
  Returns:
    Registration key object.

### removeHandlers

    void removeHandlers(K... keys)

  Removes registered handler(s).

### removeHandlers

    void removeHandlers(Iterable<K> keys)

  Removes registered handler(s).

### post

    H post(E event,
           ... validators)

  Posts event to the bus.

  Parameters:
    `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.
  Returns:
    Event handle or null if validator(s) evaluate to false.

### reset

    void reset()

  Clears join collections and handle map.

### getDerivations

    Collection<Derivation<E,P,C>> getDerivations(E event)

  Parameters:
    `event` -
  Returns:
    Derivations for the event.

### getStore

    S getStore()

  Returns:
    event store.

### remove

    void remove(E event)

  Removes event from the bus.

  Parameters:
    `event` -

### manageHandlers

    void manageHandlers(Matcher.HandlerManager<E,P,C,K,H,S> handlerManager)

  This method is used for batch live updates of bus handlers. The method acquires bus write lock, then invokes bus manager's manageBus() method within a lock and then releases the lock. Therefore, event bus structure update is executed as one logical unit.

  Parameters:
    `busManager` -

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD