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 TypeFieldDescriptionstatic final Stringprotected final Map<org.openremote.model.attribute.AttributeRef,Consumer<MQTTMessage<String>>> Fields inherited from class org.openremote.agent.protocol.io.AbstractIOClientProtocol
clientFields inherited from class org.openremote.agent.protocol.AbstractProtocol
agent, assetService, datapointService, dynamicAttributes, executorService, linkedAttributes, messageBrokerContext, predictedDatapointService, producerTemplate, timerServiceFields inherited from interface org.openremote.model.asset.agent.Protocol
ACTUATOR_TOPIC, ACTUATOR_TOPIC_TARGET_PROTOCOL, DYNAMIC_TIME_PLACEHOLDER_REGEXP, DYNAMIC_VALUE_PLACEHOLDER, DYNAMIC_VALUE_PLACEHOLDER_REGEXP, SENSOR_QUEUE, SENSOR_QUEUE_SOURCE_PROTOCOL -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected MQTT_IOClientprotected MQTTMessage<String>createWriteMessage(org.openremote.model.attribute.Attribute<?> attribute, MQTTAgentLink agentLink, org.openremote.model.attribute.AttributeEvent event, Object processedValue) Generate the actual message to send to theIOClientfor thisAttributeEventprotected MQTT_IOClientShould return an instance ofIOClientfor the linkedAgent.protected voiddoLinkAttribute(String assetId, org.openremote.model.attribute.Attribute<?> attribute, MQTTAgentLink agentLink) Link anAttributeto its linkedAgent.protected voiddoUnlinkAttribute(String assetId, org.openremote.model.attribute.Attribute<?> attribute, MQTTAgentLink agentLink) Unlink anAttributefrom its linkedAgent.Get the name for this protocolprotected voidonMessageReceived(MQTTMessage<String> message) Called when theIOClientreceives a message from the serverMethods inherited from class org.openremote.agent.protocol.io.AbstractIOClientProtocol
doLinkedAttributeWrite, doStart, doStop, getGenericStringEncodersAndDecoders, getProtocolInstanceUri, onConnectionStatusChangedMethods inherited from class org.openremote.agent.protocol.AbstractProtocol
getAgent, getLinkedAttributes, linkAttribute, processLinkedAttributeWrite, sendAttributeEvent, sendAttributeEvent, setConnectionStatus, start, stop, toString, unlinkAttribute, updateAgentAttribute, updateLinkedAttribute, updateLinkedAttributeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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
-
-
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:AbstractProtocolLink anAttributeto its linkedAgent.- Specified by:
doLinkAttributein classAbstractProtocol<MQTTAgent,MQTTAgentLink> - Throws:
RuntimeException
-
doUnlinkAttribute
protected void doUnlinkAttribute(String assetId, org.openremote.model.attribute.Attribute<?> attribute, MQTTAgentLink agentLink) Description copied from class:AbstractProtocolUnlink anAttributefrom its linkedAgent.- Specified by:
doUnlinkAttributein classAbstractProtocol<MQTTAgent,MQTTAgentLink>
-
createIoClient
- Overrides:
createIoClientin classAbstractIOClientProtocol<MQTTProtocol,MQTTAgent, MQTTMessage<String>, MQTT_IOClient, MQTTAgentLink> - Throws:
Exception
-
doCreateIoClient
Description copied from class:AbstractIOClientProtocolShould return an instance ofIOClientfor the linkedAgent.- Specified by:
doCreateIoClientin classAbstractIOClientProtocol<MQTTProtocol,MQTTAgent, MQTTMessage<String>, MQTT_IOClient, MQTTAgentLink> - Throws:
Exception
-
onMessageReceived
Description copied from class:AbstractIOClientProtocolCalled when theIOClientreceives a message from the server- Specified by:
onMessageReceivedin classAbstractIOClientProtocol<MQTTProtocol,MQTTAgent, MQTTMessage<String>, MQTT_IOClient, MQTTAgentLink>
-
createWriteMessage
protected MQTTMessage<String> createWriteMessage(org.openremote.model.attribute.Attribute<?> attribute, MQTTAgentLink agentLink, org.openremote.model.attribute.AttributeEvent event, Object processedValue) Description copied from class:AbstractIOClientProtocolGenerate the actual message to send to theIOClientfor thisAttributeEvent- Specified by:
createWriteMessagein classAbstractIOClientProtocol<MQTTProtocol,MQTTAgent, MQTTMessage<String>, MQTT_IOClient, MQTTAgentLink>
-
getProtocolName
Description copied from interface:org.openremote.model.asset.agent.ProtocolGet the name for this protocol
-