Class MQTTProtocol
java.lang.Object
org.openremote.agent.protocol.AbstractProtocol<U,X>
org.openremote.agent.protocol.io.AbstractIOClientProtocol<T,U,MQTTMessage<V>,W,X>
org.openremote.agent.protocol.mqtt.AbstractMQTTClientProtocol<MQTTProtocol,MQTTAgent,String,MQTT_IOClient,MQTTAgentLink>
org.openremote.agent.protocol.mqtt.MQTTProtocol
- All Implemented Interfaces:
org.openremote.model.asset.agent.Protocol<MQTTAgent>
public class MQTTProtocol
extends AbstractMQTTClientProtocol<MQTTProtocol,MQTTAgent,String,MQTT_IOClient,MQTTAgentLink>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.openremote.model.security.KeyStoreService
static final String
protected final Map<org.openremote.model.attribute.AttributeRef,
Consumer<MQTTMessage<String>>> Fields inherited from class org.openremote.agent.protocol.io.AbstractIOClientProtocol
client
Fields inherited from class org.openremote.agent.protocol.AbstractProtocol
agent, assetService, datapointService, dynamicAttributes, executorService, linkedAttributes, messageBrokerContext, predictedDatapointService, processorLock, producerTemplate, scheduledExecutorService, timerService
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected MQTT_IOClient
protected MQTTMessage<String>
createWriteMessage
(MQTTAgentLink agentLink, org.openremote.model.attribute.AttributeEvent event, Object processedValue) Generate the actual message to send to theIOClient
for thisAttributeEvent
protected MQTT_IOClient
Should return an instance ofIOClient
for the linkedAgent
.protected void
doLinkAttribute
(String assetId, org.openremote.model.attribute.Attribute<?> attribute, MQTTAgentLink agentLink) Link anAttribute
to its linkedAgent
.protected void
doStart
(org.openremote.model.Container container) Start this protocol instanceprotected void
doUnlinkAttribute
(String assetId, org.openremote.model.attribute.Attribute<?> attribute, MQTTAgentLink agentLink) Unlink anAttribute
from its linkedAgent
.Get the name for this protocolprotected void
onMessageReceived
(MQTTMessage<String> message) Called when theIOClient
receives a message from the serverMethods inherited from class org.openremote.agent.protocol.io.AbstractIOClientProtocol
doLinkedAttributeWrite, doStop, getGenericStringEncodersAndDecoders, getProtocolInstanceUri, onConnectionStatusChanged
Methods inherited from class org.openremote.agent.protocol.AbstractProtocol
getAgent, getLinkedAttributes, linkAttribute, onAgentAttributeChanged, processLinkedAttributeWrite, sendAttributeEvent, sendAttributeEvent, setAssetService, setConnectionStatus, start, stop, toString, unlinkAttribute, updateLinkedAttribute, updateLinkedAttribute
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.openremote.model.asset.agent.Protocol
prefixLogMessage
-
Field Details
-
PROTOCOL_DISPLAY_NAME
- See Also:
-
protocolMessageConsumers
protected final Map<org.openremote.model.attribute.AttributeRef,Consumer<MQTTMessage<String>>> protocolMessageConsumers -
keyStoreService
protected org.openremote.model.security.KeyStoreService keyStoreService
-
-
Constructor Details
-
MQTTProtocol
-
-
Method Details
-
doLinkAttribute
protected void doLinkAttribute(String assetId, org.openremote.model.attribute.Attribute<?> attribute, MQTTAgentLink agentLink) throws RuntimeException Description copied from class:AbstractProtocol
Link anAttribute
to its linkedAgent
.- Specified by:
doLinkAttribute
in classAbstractProtocol<MQTTAgent,
MQTTAgentLink> - Throws:
RuntimeException
-
doStart
Description copied from class:AbstractProtocol
Start this protocol instance- Overrides:
doStart
in classAbstractIOClientProtocol<MQTTProtocol,
MQTTAgent, MQTTMessage<String>, MQTT_IOClient, MQTTAgentLink> - Throws:
Exception
-
doUnlinkAttribute
protected void doUnlinkAttribute(String assetId, org.openremote.model.attribute.Attribute<?> attribute, MQTTAgentLink agentLink) Description copied from class:AbstractProtocol
Unlink anAttribute
from its linkedAgent
.- Specified by:
doUnlinkAttribute
in classAbstractProtocol<MQTTAgent,
MQTTAgentLink>
-
createIoClient
- Overrides:
createIoClient
in classAbstractIOClientProtocol<MQTTProtocol,
MQTTAgent, MQTTMessage<String>, MQTT_IOClient, MQTTAgentLink> - Throws:
Exception
-
doCreateIoClient
Description copied from class:AbstractIOClientProtocol
Should return an instance ofIOClient
for the linkedAgent
.- Specified by:
doCreateIoClient
in classAbstractIOClientProtocol<MQTTProtocol,
MQTTAgent, MQTTMessage<String>, MQTT_IOClient, MQTTAgentLink> - Throws:
Exception
-
onMessageReceived
Description copied from class:AbstractIOClientProtocol
Called when theIOClient
receives a message from the server- Specified by:
onMessageReceived
in classAbstractIOClientProtocol<MQTTProtocol,
MQTTAgent, MQTTMessage<String>, MQTT_IOClient, MQTTAgentLink>
-
createWriteMessage
protected MQTTMessage<String> createWriteMessage(MQTTAgentLink agentLink, org.openremote.model.attribute.AttributeEvent event, Object processedValue) Description copied from class:AbstractIOClientProtocol
Generate the actual message to send to theIOClient
for thisAttributeEvent
- Specified by:
createWriteMessage
in classAbstractIOClientProtocol<MQTTProtocol,
MQTTAgent, MQTTMessage<String>, MQTT_IOClient, MQTTAgentLink>
-
getProtocolName
Description copied from interface:org.openremote.model.asset.agent.Protocol
Get the name for this protocol
-