public interface SubscriptionManager
SensorEvent
s
and their delivery.SubscriptionContext
Modifier and Type | Method and Description |
---|---|
java.util.Set<SubscriptionHandle> |
getSubscriptionsForEntitySensor(Entity source,
Sensor<?> sensor)
Return the subscriptions on a given source-sensor pair
|
java.util.Set<SubscriptionHandle> |
getSubscriptionsForSubscriber(java.lang.Object subscriber)
Return the subscriptions requested by a given subscriber
|
<T> void |
publish(SensorEvent<T> event)
Deliver a
SensorEvent to all subscribed listeners. |
<T> SubscriptionHandle |
subscribe(Entity producer,
Sensor<T> sensor,
SensorEventListener<? super T> listener) |
<T> SubscriptionHandle |
subscribe(java.util.Map<java.lang.String,java.lang.Object> flags,
Entity producer,
Sensor<T> sensor,
SensorEventListener<? super T> listener)
Subscribe to
Sensor data changes and events on a given Entity , supplying the SensorEventListener
to invoke when they occur. |
<T> SubscriptionHandle |
subscribeToChildren(Entity parent,
Sensor<T> sensor,
SensorEventListener<? super T> listener) |
<T> SubscriptionHandle |
subscribeToChildren(java.util.Map<java.lang.String,java.lang.Object> flags,
Entity parent,
Sensor<T> sensor,
SensorEventListener<? super T> listener)
Subscribe to
Sensor data changes and events on all children of a given Entity , supplying the
SensorEventListener to invoke when they occur. |
<T> SubscriptionHandle |
subscribeToMembers(Group parent,
Sensor<T> sensor,
SensorEventListener<? super T> listener) |
<T> SubscriptionHandle |
subscribeToMembers(java.util.Map<java.lang.String,java.lang.Object> flags,
Group parent,
Sensor<T> sensor,
SensorEventListener<? super T> listener)
Subscribe to
Sensor data changes and events on all members of a given Group , supplying the
SensorEventListener to invoke when they occur. |
boolean |
unsubscribe(SubscriptionHandle subscriptionId)
Unsubscribe the given subscription id.
|
<T> SubscriptionHandle subscribe(java.util.Map<java.lang.String,java.lang.Object> flags, Entity producer, Sensor<T> sensor, SensorEventListener<? super T> listener)
Sensor
data changes and events on a given Entity
, supplying the SensorEventListener
to invoke when they occur.
The method returns an id which can be used to unsubscribe(SubscriptionHandle)
later.
The listener callback is in-order single-threaded and synchronized on this object. In other words message delivery from a producer to a given subscriber is in publish order (or in the case of a late subscriber getting initial values, in subscribe order). The flags parameters can include the following:
flags
- optional parameters to be associated with the subscriptionproducer
- entity to listen to, or null to listen to all entitiessensor
- sensor channel of events to listen to, or null for all sensors from the given producer(s)listener
- callback to invoke when an event occursunsubscribe(SubscriptionHandle)
<T> SubscriptionHandle subscribe(Entity producer, Sensor<T> sensor, SensorEventListener<? super T> listener)
<T> SubscriptionHandle subscribeToChildren(java.util.Map<java.lang.String,java.lang.Object> flags, Entity parent, Sensor<T> sensor, SensorEventListener<? super T> listener)
Sensor
data changes and events on all children of a given Entity
, supplying the
SensorEventListener
to invoke when they occur.
The subscriptions will be created recursively for all children, and the same listener callback will be invoked for each
sensor datum. The semantics are otherwise identical to the subscribe(Map, Entity, Sensor, SensorEventListener)
method.<T> SubscriptionHandle subscribeToChildren(Entity parent, Sensor<T> sensor, SensorEventListener<? super T> listener)
<T> SubscriptionHandle subscribeToMembers(java.util.Map<java.lang.String,java.lang.Object> flags, Group parent, Sensor<T> sensor, SensorEventListener<? super T> listener)
Sensor
data changes and events on all members of a given Group
, supplying the
SensorEventListener
to invoke when they occur.
The subscriptions will be created recursively for all children, and the same listener callback will be invoked for each
sensor datum. The semantics are otherwise identical to the subscribe(Map, Entity, Sensor, SensorEventListener)
method.<T> SubscriptionHandle subscribeToMembers(Group parent, Sensor<T> sensor, SensorEventListener<? super T> listener)
boolean unsubscribe(SubscriptionHandle subscriptionId)
subscribe(Map, Entity, Sensor, SensorEventListener)
<T> void publish(SensorEvent<T> event)
SensorEvent
to all subscribed listeners.java.util.Set<SubscriptionHandle> getSubscriptionsForSubscriber(java.lang.Object subscriber)
java.util.Set<SubscriptionHandle> getSubscriptionsForEntitySensor(Entity source, Sensor<?> sensor)