SPEC
- The DispatcherComponentSpec subclassTARGET
- The type that this spec will createpublic abstract class EventRoutingComponentSpec<SPEC extends EventRoutingComponentSpec<SPEC,TARGET>,TARGET> extends DispatcherComponentSpec<SPEC,TARGET>
Environment
,
Dispatcher
, and Router
.Modifier and Type | Class and Description |
---|---|
protected static class |
EventRoutingComponentSpec.EventRoutingStrategy |
Constructor and Description |
---|
EventRoutingComponentSpec() |
Modifier and Type | Method and Description |
---|---|
SPEC |
broadcastEventRouting()
Configures the component's EventRouter to broadcast events to all matching consumers
|
protected TARGET |
configure(Dispatcher dispatcher,
Environment environment) |
protected abstract TARGET |
configure(EventBus reactor,
Environment environment) |
SPEC |
consumerNotFoundHandler(Consumer<Object> consumerNotFoundHandler)
Configures the callback to invoke if a notification key is sent into this component and there are no consumers
registered to respond to it.
|
SPEC |
consumerRegistry(Registry<Object,Consumer<? extends Event<?>>> consumerRegistry)
Configures the
Registry to use when creating this component. |
SPEC |
dispatchErrorHandler(Consumer<Throwable> dispatchErrorHandler)
Configures the component's error handler for any errors occurring during dispatch (e.g.
|
SPEC |
eventFilter(Filter filter)
Assigns the component's Filter
|
SPEC |
eventRouter(Router router)
Assigns the component's EventRouter
|
SPEC |
firstEventRouting()
Configures the component's EventRouter to route events to the first of the matching consumers
|
SPEC |
randomEventRouting()
Configures the component's EventRouter to route events to one consumer that's randomly selected from that matching
consumers
|
SPEC |
roundRobinEventRouting()
Configures the component's EventRouter to route events to one consumer selected from the matching consumers using a
round-robin algorithm consumers
|
SPEC |
traceEventPath()
Configures this component to provide event tracing when dispatching and routing an event.
|
SPEC |
traceEventPath(boolean b)
Configures this component to provide or not provide event tracing when dispatching and routing an event.
|
SPEC |
uncaughtErrorHandler(Consumer<Throwable> uncaughtErrorHandler)
Configures the component's uncaught error handler for any errors that get reported into this component but aren't a
direct result of dispatching (e.g. errors that originate from another component).
|
defaultDispatcher, dispatcher, dispatcher, env, get, synchronousDispatcher
public final SPEC eventFilter(Filter filter)
this
public final SPEC eventRouter(Router router)
this
public final SPEC broadcastEventRouting()
this
public final SPEC randomEventRouting()
this
public final SPEC firstEventRouting()
this
public final SPEC roundRobinEventRouting()
this
public SPEC dispatchErrorHandler(Consumer<Throwable> dispatchErrorHandler)
Consumer#accept
method.dispatchErrorHandler
- the error handler for dispatching errorsthis
public SPEC uncaughtErrorHandler(Consumer<Throwable> uncaughtErrorHandler)
uncaughtErrorHandler
- the error handler for uncaught errorsthis
public final SPEC traceEventPath()
this
public final SPEC traceEventPath(boolean b)
b
- whether to trace the event path or notthis
public SPEC consumerRegistry(Registry<Object,Consumer<? extends Event<?>>> consumerRegistry)
Registry
to use when creating this component. Registries can be
shared to reduce GC pressure and potentially be persisted across restarts.consumerRegistry
- the consumer registry to usethis
public SPEC consumerNotFoundHandler(Consumer<Object> consumerNotFoundHandler)
consumerNotFoundHandler
- the not found handler to usethis
protected abstract TARGET configure(EventBus reactor, Environment environment)
protected final TARGET configure(Dispatcher dispatcher, Environment environment)
configure
in class DispatcherComponentSpec<SPEC extends EventRoutingComponentSpec<SPEC,TARGET>,TARGET>
Copyright © 2016. All rights reserved.