Brooklyn

brooklyn.management
[Java] Interface SubscriptionManager


public interface SubscriptionManager

The mangement interface for subscriptions. Different implementations will handle entities subscribing and unsubscribing to SensorEvents and their delivery.

See Also:
SubscriptionContext


Method Summary
java.util.Set getSubscriptionsForEntitySensor(Entity source, Sensor sensor)

Return the subscriptions on a given source-sensor pair

java.util.Set getSubscriptionsForSubscriber(java.lang.Object subscriber)

Return the subscriptions requested by a given subscriber

void publish(SensorEvent event)

Deliver a SensorEvent to all subscribed listeners.

SubscriptionHandle subscribe(java.util.Map flags, Entity producer, Sensor sensor, SensorEventListener listener)

Subscribe to Sensor data changes and events on a given Entity, supplying the SensorEventListener to invoke when they occur.

SubscriptionHandle subscribe(Entity parent, Sensor sensor, SensorEventListener listener)

@see #subscribe(Map, Entity, Sensor, SensorEventListener)

SubscriptionHandle subscribeToChildren(java.util.Map flags, Entity parent, Sensor sensor, SensorEventListener listener)

Subscribe to Sensor data changes and events on all children of a given Entity, supplying the SensorEventListener to invoke when they occur.

SubscriptionHandle subscribeToChildren(Entity parent, Sensor sensor, SensorEventListener listener)

@see #subscribeToChildren(Map, Entity, Sensor, SensorEventListener)

SubscriptionHandle subscribeToMembers(java.util.Map flags, Group parent, Sensor sensor, SensorEventListener listener)

Subscribe to Sensor data changes and events on all members of a given Group, supplying the SensorEventListener to invoke when they occur.

SubscriptionHandle subscribeToMembers(Group parent, Sensor sensor, SensorEventListener listener)

@see #subscribeToChildren(Map, Group, Sensor, SensorEventListener)

boolean unsubscribe(SubscriptionHandle subscriptionId)

Unsubscribe the given subscription id.

 

Method Detail

getSubscriptionsForEntitySensor

public java.util.Set getSubscriptionsForEntitySensor(Entity source, Sensor sensor)
Return the subscriptions on a given source-sensor pair


getSubscriptionsForSubscriber

public java.util.Set getSubscriptionsForSubscriber(java.lang.Object subscriber)
Return the subscriptions requested by a given subscriber


publish

public void publish(SensorEvent event)
Deliver a SensorEvent to all subscribed listeners.


subscribe

public SubscriptionHandle subscribe(java.util.Map flags, Entity producer, Sensor sensor, SensorEventListener listener)
Subscribe to 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. The flags parameters can include the following:

Parameters:
flags - optional parameters to be associated with the subscription
producer - entity to listen to
sensor - sensor channel of events to listen to
listener - callback to invoke when an event occurs
Returns:
an id for this subscription
See Also:
unsubscribe(SubscriptionHandle)


subscribe

public SubscriptionHandle subscribe(Entity parent, Sensor sensor, SensorEventListener listener)
See Also:
subscribe(Map, Entity, Sensor, SensorEventListener)


subscribeToChildren

public SubscriptionHandle subscribeToChildren(java.util.Map flags, Entity parent, Sensor sensor, SensorEventListener listener)
Subscribe to 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.
See Also:
subscribe(Map, Entity, Sensor, SensorEventListener)


subscribeToChildren

public SubscriptionHandle subscribeToChildren(Entity parent, Sensor sensor, SensorEventListener listener)
See Also:
subscribeToChildren(Map, Entity, Sensor, SensorEventListener)


subscribeToMembers

public SubscriptionHandle subscribeToMembers(java.util.Map flags, Group parent, Sensor sensor, SensorEventListener listener)
Subscribe to 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.
See Also:
subscribe(Map, Entity, Sensor, SensorEventListener)


subscribeToMembers

public SubscriptionHandle subscribeToMembers(Group parent, Sensor sensor, SensorEventListener listener)
See Also:
subscribeToChildren(Map, Group, Sensor, SensorEventListener)


unsubscribe

public boolean unsubscribe(SubscriptionHandle subscriptionId)
Unsubscribe the given subscription id.
Returns:
true if such a subscription was present (and it will now be removed)
See Also:
subscribe(Map, Entity, Sensor, SensorEventListener)


 

Brooklyn Multi-Cloud Application Management Platform
brooklyncentral.github.com. Apache License. © 2012.