|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.stuffthathappens.classbus.BasicEventService
public class BasicEventService
The default implementation of EventService. This provides weak references
to subscribers and thread-safe subscription/notification.
| Constructor Summary | |
|---|---|
BasicEventService(DeliveryStrategy deliveryStrategy)
Construct a new instance. |
|
| Method Summary | ||
|---|---|---|
|
publish(java.lang.String channel,
T event)
Publish an event to a particular channel. |
|
|
publish(java.lang.String channel,
T event,
DeliveryCompleteCallback<T> callback)
Publish an event to a particular channel, notifying a callback after delivery completes. |
|
|
publish(T event)
Publish an event to the null channel. |
|
|
publish(T event,
DeliveryCompleteCallback<T> callback)
Publish an event to the null channel, notifying a callback after delivery completes. |
|
|
subscribe(Matcher<java.lang.String> channelMatcher,
Matcher<java.lang.Object> eventMatcher,
EventSubscriber<T> subscriber)
Register a subscriber that will be notified if the sent event matches both the channelMatcher and the eventMatcher. |
|
|
unsubscribe(EventSubscriber<T> subscriber)
Completely remove the given subscriber from all channel and event matchers. |
|
|
unsubscribe(Matcher<java.lang.String> channelMatcher,
Matcher<java.lang.Object> eventMatcher,
EventSubscriber<T> subscriber)
Remove a subscriber provided we find a matching channelMatcher and eventMatcher. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public BasicEventService(DeliveryStrategy deliveryStrategy)
deliveryStrategy - defines how threads are used during event delivery.| Method Detail |
|---|
public <T> EventSubscriber<T> subscribe(Matcher<java.lang.String> channelMatcher,
Matcher<java.lang.Object> eventMatcher,
EventSubscriber<T> subscriber)
EventService
subscribe in interface EventServicechannelMatcher - filters based on the event channel.eventMatcher - filters based on the event object.subscriber - will be notified of all events passing both channelMatcher
and eventMatcher.
public <T> void unsubscribe(Matcher<java.lang.String> channelMatcher,
Matcher<java.lang.Object> eventMatcher,
EventSubscriber<T> subscriber)
EventService
unsubscribe in interface EventServicechannelMatcher - the channel matcher to locate.eventMatcher - the event matcher to locate.subscriber - the subscriber to remove.public <T> void unsubscribe(EventSubscriber<T> subscriber)
EventService
unsubscribe in interface EventServicesubscriber - the subscriber to remove.public <T> void publish(T event)
EventService
publish in interface EventServiceevent - the object to send to matching subscribers.EventSubscriber.onEvent(Object),
EventService.publish(String, Object)
public <T> void publish(java.lang.String channel,
T event)
EventService
publish in interface EventServicechannel - a String channel name (can be anything), or even null.event - the object to send to matching subscribers.EventSubscriber.onEvent(Object),
EventService.publish(Object)
public <T> void publish(T event,
DeliveryCompleteCallback<T> callback)
EventService
publish in interface EventServiceevent - the object to send to matching subscribers.callback - the object to notify after delivery.EventSubscriber.onEvent(Object)
public <T> void publish(java.lang.String channel,
T event,
DeliveryCompleteCallback<T> callback)
EventService
publish in interface EventServicechannel - a String channel name (can be anything), or even null.event - the object to send to matching subscribers.callback - the object to notify after delivery.EventSubscriber.onEvent(Object)
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||