public class MqttTransporter extends Transporter implements net.sf.xenqtt.client.AsyncClientListener
ServiceBroker broker = ServiceBroker.builder().nodeID("node1").transporter(new MqttTransporter("localhost")).build();
Required dependency:| Modifier and Type | Field and Description |
|---|---|
protected int |
blockingTimeoutSeconds |
protected boolean |
cleanSession |
protected net.sf.xenqtt.client.AsyncMqttClient |
client |
protected int |
connectTimeoutSeconds |
protected short |
keepAliveSeconds |
protected int |
maxInFlightMessages |
protected int |
messageResendIntervalSeconds |
protected java.lang.String |
password |
protected net.sf.xenqtt.message.QoS |
qos |
protected java.util.concurrent.ConcurrentHashMap<java.lang.String,io.datatree.Promise> |
subscriptions |
protected java.lang.String |
url |
protected java.lang.String |
username |
checkTimeoutTimer, counterTransporterPacketsReceivedBytes, counterTransporterPacketsReceivedTotal, counterTransporterPacketsSentBytes, counterTransporterPacketsSentTotal, debug, debugHeartbeats, disconnectChannel, discoverBroadcastChannel, discoverChannel, eventbus, eventChannel, executor, gaugeTransitConnected, heartbeatChannel, heartbeatInterval, heartbeatTimeout, heartBeatTimer, infoBroadcastChannel, infoChannel, infoScheduled, infoScheduledAt, instanceID, lastReceivedMessageAt, metrics, monitor, namespace, nodeID, nodes, offlineTimeout, PACKET_DISCONNECT, PACKET_DISCOVER, PACKET_EVENT, PACKET_HEARTBEAT, PACKET_INFO, PACKET_PING, PACKET_PONG, PACKET_REQUEST, PACKET_RESPONSE, pingChannel, pongChannel, preferHostname, prefix, protocolVersion, registry, requestChannel, responseChannel, scheduler, serializer, serviceInvoker, subscriptionTimeout, uidGenerator, usingJsonSerializerbroker, logger, nameMOLECULER_CACHER_CLEAN_TIME, MOLECULER_CACHER_CLEAN_TIME_DESC, MOLECULER_CACHER_CLEAN_TOTAL, MOLECULER_CACHER_CLEAN_TOTAL_DESC, MOLECULER_CACHER_DEL_TIME, MOLECULER_CACHER_DEL_TIME_DESC, MOLECULER_CACHER_DEL_TOTAL, MOLECULER_CACHER_DEL_TOTAL_DESC, MOLECULER_CACHER_EXPIRED_TOTAL, MOLECULER_CACHER_EXPIRED_TOTAL_DESC, MOLECULER_CACHER_FOUND_TOTAL, MOLECULER_CACHER_FOUND_TOTAL_DESC, MOLECULER_CACHER_GET_TIME, MOLECULER_CACHER_GET_TIME_DESC, MOLECULER_CACHER_GET_TOTAL, MOLECULER_CACHER_GET_TOTAL_DESC, MOLECULER_CACHER_SET_TIME, MOLECULER_CACHER_SET_TIME_DESC, MOLECULER_CACHER_SET_TOTAL, MOLECULER_CACHER_SET_TOTAL_DESC, MOLECULER_CIRCUIT_BREAKER_HALF_OPENED_ACTIVE, MOLECULER_CIRCUIT_BREAKER_HALF_OPENED_ACTIVE_DESC, MOLECULER_CIRCUIT_BREAKER_OPENED_ACTIVE, MOLECULER_CIRCUIT_BREAKER_OPENED_ACTIVE_DESC, MOLECULER_CIRCUIT_BREAKER_OPENED_TOTAL, MOLECULER_CIRCUIT_BREAKER_OPENED_TOTAL_DESC, MOLECULER_EVENT_BROADCAST_TOTAL, MOLECULER_EVENT_BROADCAST_TOTAL_DESC, MOLECULER_EVENT_BROADCASTLOCAL_TOTAL, MOLECULER_EVENT_BROADCASTLOCAL_TOTAL_DESC, MOLECULER_EVENT_EMIT_TOTAL, MOLECULER_EVENT_EMIT_TOTAL_DESC, MOLECULER_EVENT_RECEIVED_ACTIVE, MOLECULER_EVENT_RECEIVED_ACTIVE_DESC, MOLECULER_EVENT_RECEIVED_ERROR_TOTAL, MOLECULER_EVENT_RECEIVED_ERROR_TOTAL_DESC, MOLECULER_EVENT_RECEIVED_TIME, MOLECULER_EVENT_RECEIVED_TIME_DESC, MOLECULER_EVENT_RECEIVED_TOTAL, MOLECULER_EVENT_RECEIVED_TOTAL_DESC, MOLECULER_EXECUTOR, MOLECULER_REQUEST_ACTIVE, MOLECULER_REQUEST_ACTIVE_DESC, MOLECULER_REQUEST_ERROR_TOTAL, MOLECULER_REQUEST_ERROR_TOTAL_DESC, MOLECULER_REQUEST_LEVELS, MOLECULER_REQUEST_LEVELS_DESC, MOLECULER_REQUEST_RETRY_ATTEMPTS_TOTAL, MOLECULER_REQUEST_RETRY_ATTEMPTS_TOTAL_DESC, MOLECULER_REQUEST_TIME, MOLECULER_REQUEST_TIME_DESC, MOLECULER_REQUEST_TIMEOUT_TOTAL, MOLECULER_REQUEST_TIMEOUT_TOTAL_DESC, MOLECULER_REQUEST_TOTAL, MOLECULER_REQUEST_TOTAL_DESC, MOLECULER_SCHEDULER, MOLECULER_TRANSIT_CONNECTED, MOLECULER_TRANSIT_CONNECTED_DESC, MOLECULER_TRANSIT_ORPHAN_RESPONSE_TOTAL, MOLECULER_TRANSIT_ORPHAN_RESPONSE_TOTAL_DESC, MOLECULER_TRANSIT_REQUESTS_ACTIVE, MOLECULER_TRANSIT_REQUESTS_ACTIVE_DESC, MOLECULER_TRANSIT_STREAMS_RECEIVE_ACTIVE, MOLECULER_TRANSIT_STREAMS_RECEIVE_ACTIVE_DESC, MOLECULER_TRANSPORTER_PACKETS_RECEIVED_BYTES, MOLECULER_TRANSPORTER_PACKETS_RECEIVED_BYTES_DESC, MOLECULER_TRANSPORTER_PACKETS_RECEIVED_TOTAL, MOLECULER_TRANSPORTER_PACKETS_RECEIVED_TOTAL_DESC, MOLECULER_TRANSPORTER_PACKETS_SENT_BYTES, MOLECULER_TRANSPORTER_PACKETS_SENT_BYTES_DESC, MOLECULER_TRANSPORTER_PACKETS_SENT_TOTAL, MOLECULER_TRANSPORTER_PACKETS_SENT_TOTAL_DESC| Constructor and Description |
|---|
MqttTransporter() |
MqttTransporter(java.lang.String url) |
MqttTransporter(java.lang.String username,
java.lang.String password,
java.lang.String url) |
| Modifier and Type | Method and Description |
|---|---|
void |
connect() |
void |
connected(net.sf.xenqtt.client.MqttClient client,
net.sf.xenqtt.message.ConnectReturnCode returnCode) |
protected void |
disconnect() |
void |
disconnected(net.sf.xenqtt.client.MqttClient client,
java.lang.Throwable cause,
boolean reconnecting) |
protected void |
error(java.lang.Throwable cause)
Any I/O error occurred.
|
int |
getBlockingTimeoutSeconds() |
int |
getConnectTimeoutSeconds() |
short |
getKeepAliveSeconds() |
int |
getMaxInFlightMessages() |
int |
getMessageResendIntervalSeconds() |
java.lang.String |
getPassword() |
net.sf.xenqtt.message.QoS |
getQos() |
java.lang.String |
getUrl() |
java.lang.String |
getUsername() |
boolean |
isCleanSession() |
void |
publish(java.lang.String channel,
io.datatree.Tree message) |
void |
published(net.sf.xenqtt.client.MqttClient client,
net.sf.xenqtt.client.PublishMessage message) |
void |
publishReceived(net.sf.xenqtt.client.MqttClient client,
net.sf.xenqtt.client.PublishMessage message) |
protected void |
reconnect(java.lang.Throwable cause) |
void |
setBlockingTimeoutSeconds(int blockingTimeoutSeconds) |
void |
setCleanSession(boolean cleanSession) |
void |
setConnectTimeoutSeconds(int connectTimeoutSeconds) |
void |
setKeepAliveSeconds(short keepAliveInterval) |
void |
setMaxInFlightMessages(int maxInFlightMessages) |
void |
setMessageResendIntervalSeconds(int messageResendIntervalSeconds) |
void |
setPassword(java.lang.String password) |
void |
setQos(net.sf.xenqtt.message.QoS qos) |
void |
setUrl(java.lang.String url) |
void |
setUsername(java.lang.String username) |
void |
stopped()
Closes transporter.
|
io.datatree.Promise |
subscribe(java.lang.String channel) |
void |
subscribed(net.sf.xenqtt.client.MqttClient client,
net.sf.xenqtt.client.Subscription[] requestedSubscriptions,
net.sf.xenqtt.client.Subscription[] grantedSubscriptions,
boolean requestsGranted) |
void |
unsubscribed(net.sf.xenqtt.client.MqttClient client,
java.lang.String[] topics) |
broadcastInfoPacket, broadcastNodeConnected, broadcastNodeDisconnected, broadcastNodeUpdated, broadcastTransporterConnected, broadcastTransporterDisconnected, channel, checkTimeouts, connected, connected, createPingPacket, getAddress, getAllNodeIDs, getCpuUsage, getDescriptor, getHeartbeatInterval, getHeartbeatTimeout, getInstanceID, getLastHeartbeatTime, getNamespace, getOfflineTimeout, getPrefix, getSerializer, getSubscriptionTimeout, isDebug, isDebugHeartbeats, isOnline, isPreferHostname, processReceivedMessage, processReceivedMessage, publish, received, scheduleInfoPacket, sendClosePacket, sendDataPacket, sendDisconnectPacket, sendDiscoverPacket, sendErrorPacket, sendEventPacket, sendHeartbeatPacket, sendInfoPacket, sendPongPacket, sendRequestPacket, setDebug, setDebugHeartbeats, setHeartbeatInterval, setHeartbeatTimeout, setNamespace, setOfflineTimeout, setPreferHostname, setPrefix, setSerializer, setSubscriptionTimeout, started, subscribe, updateNodeInfogetBroker, getLogger, getNameprotected java.lang.String username
protected java.lang.String password
protected java.lang.String url
protected boolean cleanSession
protected short keepAliveSeconds
protected int connectTimeoutSeconds
protected int messageResendIntervalSeconds
protected int blockingTimeoutSeconds
protected int maxInFlightMessages
protected net.sf.xenqtt.message.QoS qos
protected final java.util.concurrent.ConcurrentHashMap<java.lang.String,io.datatree.Promise> subscriptions
protected net.sf.xenqtt.client.AsyncMqttClient client
public MqttTransporter()
public MqttTransporter(java.lang.String url)
public MqttTransporter(java.lang.String username,
java.lang.String password,
java.lang.String url)
public void connect()
connect in class Transporterpublic void connected(net.sf.xenqtt.client.MqttClient client,
net.sf.xenqtt.message.ConnectReturnCode returnCode)
connected in interface net.sf.xenqtt.client.AsyncClientListenerpublic void disconnected(net.sf.xenqtt.client.MqttClient client,
java.lang.Throwable cause,
boolean reconnecting)
disconnected in interface net.sf.xenqtt.client.MqttClientListenerprotected void disconnect()
protected void reconnect(java.lang.Throwable cause)
protected void error(java.lang.Throwable cause)
Transportererror in class Transportercause - I/O errorpublic void stopped()
stopped in interface MoleculerLifecyclestopped in class Transporterpublic io.datatree.Promise subscribe(java.lang.String channel)
subscribe in class Transporterpublic void subscribed(net.sf.xenqtt.client.MqttClient client,
net.sf.xenqtt.client.Subscription[] requestedSubscriptions,
net.sf.xenqtt.client.Subscription[] grantedSubscriptions,
boolean requestsGranted)
subscribed in interface net.sf.xenqtt.client.AsyncClientListenerpublic void unsubscribed(net.sf.xenqtt.client.MqttClient client,
java.lang.String[] topics)
unsubscribed in interface net.sf.xenqtt.client.AsyncClientListenerpublic void publish(java.lang.String channel,
io.datatree.Tree message)
publish in class Transporterpublic void published(net.sf.xenqtt.client.MqttClient client,
net.sf.xenqtt.client.PublishMessage message)
published in interface net.sf.xenqtt.client.AsyncClientListenerpublic void publishReceived(net.sf.xenqtt.client.MqttClient client,
net.sf.xenqtt.client.PublishMessage message)
publishReceived in interface net.sf.xenqtt.client.MqttClientListenerpublic java.lang.String getUrl()
public void setUrl(java.lang.String url)
public java.lang.String getUsername()
public void setUsername(java.lang.String username)
public java.lang.String getPassword()
public void setPassword(java.lang.String password)
public boolean isCleanSession()
public void setCleanSession(boolean cleanSession)
public short getKeepAliveSeconds()
public void setKeepAliveSeconds(short keepAliveInterval)
public int getConnectTimeoutSeconds()
public void setConnectTimeoutSeconds(int connectTimeoutSeconds)
public int getMessageResendIntervalSeconds()
public void setMessageResendIntervalSeconds(int messageResendIntervalSeconds)
public int getBlockingTimeoutSeconds()
public void setBlockingTimeoutSeconds(int blockingTimeoutSeconds)
public int getMaxInFlightMessages()
public void setMaxInFlightMessages(int maxInFlightMessages)
public net.sf.xenqtt.message.QoS getQos()
public void setQos(net.sf.xenqtt.message.QoS qos)