@ProviderType
public interface CloudSubscriber
CloudEndpoint
that wraps the
specificities related to the targeted cloud provider.
The CloudSubscriber
interface is an abstraction on top of the CloudEndpoint
to simplify the
subscription and notification process, for each application running in the framework.
When an application wants to receive a message from the cloud, it has to take a CloudSubscriber
instance and
register itself as a CloudSubscriberListener
, in order to be notified when a message is received from the
associated cloud stack.
In most cases, the consumers are not interested in the header of the received message and assume to always receive the
same kind of message. In order to receive different kinds of messages, the consumer should register to multiple
subscribers.
Some messaging protocols have a hierarchical addressing structure supporting multilevel wildcard subscriptions. For
example, an MQTT address (topic) hierarchy might look like
building/${building-number}/apartment/${apartment-number}/heating/temperature.
To receive the heating temperature measurements for all the buildings and apartments the subscriber can be configured
to subscribe to building/+/apartment/+/heating/temperature. When a message is received, the subscriber will notify
the application providing the payload received and some properties that are implementation specific, depending on the
subscriber, and that can allow the application to understand the corresponding resource.Modifier and Type | Method and Description |
---|---|
void |
registerCloudConnectionListener(CloudConnectionListener cloudConnectionListener)
The implementation will register the
CloudConnectionListener instance passed as argument. |
void |
registerCloudSubscriberListener(CloudSubscriberListener listener)
Registers the
CloudSubscriberListener instance passed as an argument. |
void |
unregisterCloudConnectionListener(CloudConnectionListener cloudConnectionListener)
Unregisters the provided
CloudConnectionListener instance from cloud connection related events
notifications. |
void |
unregisterCloudSubscriberListener(CloudSubscriberListener listener)
Unregisters the provided
CloudSubscriberListener from the list of the notified listeners. |
void registerCloudSubscriberListener(CloudSubscriberListener listener)
CloudSubscriberListener
instance passed as an argument. All the registered
CloudSubscriberListener
s will be notified by the implementation when a message is received.listener
- a CloudSubscriberListener
instance that will be notified when a message will be received from
the remote cloud platform.void unregisterCloudSubscriberListener(CloudSubscriberListener listener)
CloudSubscriberListener
from the list of the notified listeners.listener
- void registerCloudConnectionListener(CloudConnectionListener cloudConnectionListener)
CloudConnectionListener
instance passed as argument. Once a cloud
connection related event happens, all the registered CloudConnectionListener
s will be notified.cloudConnectionListener
- a CloudConnectionListener
instancevoid unregisterCloudConnectionListener(CloudConnectionListener cloudConnectionListener)
CloudConnectionListener
instance from cloud connection related events
notifications.cloudConnectionListener
-