|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface DataService
The DataService provides the ability of connecting to a remote
broker, publish messages, subscribe to topics, receive messages on the
subscribed topics, and disconnect from the remote message broker.
The DataService delegates to the DataTransportService
the implementation
of the transport protocol used to interact with the remote server.
The DataService offers methods and configuration options to manage the
connection to the remote server. For example, it can be configured
to auto-connect to the remote server on start-up or it offers
methods for applications to directly manage the connection.
It also adds the capability of storing published messages in a persistent store
and send them over the wire at a later time.
The purpose is to relieve service users from implementing their own persistent store.
Service users may publish messages independently on the DataService connection status.
In order to overcome the potential latencies introduced by buffering messages,
the DataService allows to assign a priority level to each published message.
Dependently on the store configuration there are certain guarantees that stored
messages are not lost due to sudden crashes or power outages.
The whiteboard pattern http://www.osgi.org/wiki/uploads/Links/whiteboard.pdf
is used to notify the service users about events such as message arrived, connection lost etc.
DataServiceListener
Method Summary | |
---|---|
void |
connect()
Connects to the broker if not already connected. |
void |
disconnect(long quiesceTimeout)
Disconnects from the broker. |
List<Integer> |
getDroppedInFlightMessageIds(String topicRegex)
Finds the list of identifiers of in-flight messages that have been dropped. |
List<Integer> |
getInFlightMessageIds(String topicRegex)
Finds the list of identifiers of messages that are still in-flight (messages published but not confirmed yet). |
int |
getRetryInterval()
|
List<Integer> |
getUnpublishedMessageIds(String topicRegex)
Finds the list of identifiers of messages that have not been published yet. |
boolean |
isAutoConnectEnabled()
|
boolean |
isConnected()
Answers if the DataService is connected to the broker. |
int |
publish(String topic,
byte[] payload,
int qos,
boolean retain,
int priority)
Publishes a message to the broker. |
void |
subscribe(String topic,
int qos)
Subscribes to the specified topic with the remote server. |
void |
unsubscribe(String topic)
Unubscribes to the specified topic with the remote server. |
Method Detail |
---|
void connect() throws EsfConnectException
EsfConnectException
boolean isConnected()
boolean isAutoConnectEnabled()
int getRetryInterval()
void disconnect(long quiesceTimeout)
quiesceTimeout
- void subscribe(String topic, int qos) throws EsfTimeoutException, EsfException, EsfNotConnectedException
DataTransportService.subscribe(java.lang.String, int)
method.
topic
- qos
-
EsfTimeoutException
EsfException
EsfNotConnectedException
- TODOvoid unsubscribe(String topic) throws EsfTimeoutException, EsfException, EsfNotConnectedException
DataTransportService.unsubscribe(java.lang.String)
method.
topic
-
EsfTimeoutException
EsfException
EsfNotConnectedException
- TODOint publish(String topic, byte[] payload, int qos, boolean retain, int priority) throws EsfStoreException
DataServiceListener.onMessageConfirmed(int, java.lang.String)
callback.
A unique identifier is always returned, independently on the specified
QoS or priority level, which can be used to match the asynchronous
message confirm.
The actual semantics associated to a message confirm is as follows:
topic
- payload
- qos
- retain
- priority
-
EsfStoreException
List<Integer> getUnpublishedMessageIds(String topicRegex) throws EsfStoreException
topicRegex
-
EsfStoreException
List<Integer> getInFlightMessageIds(String topicRegex) throws EsfStoreException
topicRegex
-
EsfStoreException
List<Integer> getDroppedInFlightMessageIds(String topicRegex) throws EsfStoreException
EsfStoreException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |