Interface EventBus
-
- All Known Implementing Classes:
EventBusImpl
public interface EventBusTheEventBusclass is used to distribute events to all subscribers.- See Also:
- EventMaid Documentation
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidpublish(Object event)Send the event to all interested subscribers.<T> SubscriptionIdreactTo(Class<T> tClass, Consumer<T> consumer)Adds theConsumerasSubscriberfor the given event class.voidunsubscribe(SubscriptionId subscriptionId)Removes allSubscribersmatching the givenSubscriptionId.
-
-
-
Method Detail
-
publish
void publish(Object event)
Send the event to all interested subscribers.- Parameters:
event- the event to publish
-
reactTo
<T> SubscriptionId reactTo(Class<T> tClass, Consumer<T> consumer)
Adds theConsumerasSubscriberfor the given event class.- Type Parameters:
T- the type of the event- Parameters:
tClass- the class of the eventconsumer- theConsumerto be called- Returns:
- the
Subscriber'sSubscriptionId
-
unsubscribe
void unsubscribe(SubscriptionId subscriptionId)
Removes allSubscribersmatching the givenSubscriptionId.- Parameters:
subscriptionId- theSubscriptionIdto be removed
-
-