public interface Transport
| Modifier and Type | Method and Description |
|---|---|
void |
connect()
Connect
|
void |
disconnect()
Disconnect gracefully
A later call to connect() must be possible. |
void |
sendMessage(Topic topic,
byte[] payload)
Send a message to a topic
|
default void |
sendMessage(Topic topic,
Map<String,Object> metrics)
Deprecated.
|
void |
subscribe(Topic topic,
java.util.function.Consumer<Message> consumer)
Subscribe to a topic or topic pattern
|
void |
unsubscribe(Topic topic)
Unsubscribe from a topic or topic pattern
|
void |
whenConnected(Runnable runnable)
Set the runnable which will be called when a connection was established
|
void |
whenDisconnected(Runnable runnable)
Set the runnable which will be called when a connection was lost
|
void connect()
void disconnect()
connect() must be possible.void whenConnected(Runnable runnable)
Note: When the connection is already established then this method won't be called again.
void whenDisconnected(Runnable runnable)
void subscribe(Topic topic, java.util.function.Consumer<Message> consumer)
topic - the topic to subscribe toconsumer - the consumer to call when a message was receivedvoid unsubscribe(Topic topic)
topic - to unsubscribe fromvoid sendMessage(Topic topic, byte[] payload)
topic - the topic to send the message topayload - the payload to send@Deprecated default void sendMessage(Topic topic, Map<String,Object> metrics)
Copyright © 2017. All rights reserved.