public class ConsumerFilteringEventRouter extends java.lang.Object implements EventRouter
EventRouter that filters consumers before routing events to
them.| Constructor and Description |
|---|
ConsumerFilteringEventRouter(Filter filter,
ConsumerInvoker consumerInvoker)
Creates a new
ConsumerFilteringEventRouter that will use the filter to filter consumers. |
| Modifier and Type | Method and Description |
|---|---|
ConsumerInvoker |
getConsumerInvoker()
Returns the
ConsumerInvoker being used by the event router |
Filter |
getFilter()
Returns the
Filter being used |
void |
route(java.lang.Object key,
Event<?> event,
java.util.List<Registration<? extends Consumer<? extends Event<?>>>> consumers,
Consumer<?> completionConsumer,
Consumer<java.lang.Throwable> errorConsumer)
Routes the
event, triggered by a notification with the given key to the
consumers. |
public ConsumerFilteringEventRouter(Filter filter, ConsumerInvoker consumerInvoker)
ConsumerFilteringEventRouter that will use the filter to filter consumers.filter - The filter to use. Must not be null.consumerInvoker - Used to invoke consumers. Must not be null.java.lang.IllegalArgumentException - if filter or consumerInvoker is null.public void route(java.lang.Object key,
Event<?> event,
java.util.List<Registration<? extends Consumer<? extends Event<?>>>> consumers,
Consumer<?> completionConsumer,
Consumer<java.lang.Throwable> errorConsumer)
EventRouterevent, triggered by a notification with the given key to the
consumers. Depending on the router implementation, zero or more of the consumers
will receive the event. Upon successful completion of the event routing, the
completionConsumer will be invoked. completionConsumer may be null. In the
event of an exception during routing the errorConsumer is invoked.
errorConsumer may be null, in which case the exception is swallowed.route in interface EventRouterkey - The notification keyevent - The Event to routeconsumers - The Consumers to route the event to.completionConsumer - The Consumer to invoke upon successful completion of event routingerrorConsumer - The Consumer to invoke when an error occurs during event routingpublic Filter getFilter()
Filter being usedFilter.public ConsumerInvoker getConsumerInvoker()
ConsumerInvoker being used by the event routerConsumerInvoker.