blob: d7f268c65f9cb6589e5e76f0ad0010793106bfe0 [file] [log] [blame]
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"></meta><title>PublishMQTT</title><link rel="stylesheet" href="../../../../../css/component-usage.css" type="text/css"></link></head><script type="text/javascript">window.onload = function(){if(self==top) { document.getElementById('nameHeader').style.display = "inherit"; } }</script><body><h1 id="nameHeader" style="display: none;">PublishMQTT</h1><h2>Description: </h2><p>Publishes a message to an MQTT topic</p><h3>Tags: </h3><p>publish, MQTT, IOT</p><h3>Properties: </h3><p>In the list below, the names of required properties appear in <strong>bold</strong>. Any other properties (not in bold) are considered optional. The table also indicates any default values, and whether a property supports the <a href="../../../../../html/expression-language-guide.html">NiFi Expression Language</a>.</p><table id="properties"><tr><th>Display Name</th><th>API Name</th><th>Default Value</th><th>Allowable Values</th><th>Description</th></tr><tr><td id="name"><strong>Broker URI</strong></td><td>Broker URI</td><td></td><td id="allowable-values"></td><td id="description">The URI(s) to use to connect to the MQTT broker (e.g., tcp://localhost:1883). The 'tcp', 'ssl', 'ws' and 'wss' schemes are supported. In order to use 'ssl', the SSL Context Service property must be set. When a comma-separated URI list is set (e.g., tcp://localhost:1883,tcp://localhost:1884), the processor will use a round-robin algorithm to connect to the brokers on connection failure.<br/><strong>Supports Expression Language: true (will be evaluated using variable registry only)</strong></td></tr><tr><td id="name"><strong>MQTT Specification Version</strong></td><td>MQTT Specification Version</td><td id="default-value">v3 AUTO</td><td id="allowable-values"><ul><li>v3 AUTO <img src="../../../../../html/images/iconInfo.png" alt="Start with v3.1.1 and fallback to v3.1.0 if not supported by a broker" title="Start with v3.1.1 and fallback to v3.1.0 if not supported by a broker"></img></li><li>v5.0</li><li>v3.1.1</li><li>v3.1.0</li></ul></td><td id="description">The MQTT specification version when connecting with the broker. See the allowable value descriptions for more details.</td></tr><tr><td id="name">Username</td><td>Username</td><td></td><td id="allowable-values"></td><td id="description">Username to use when connecting to the broker<br/><strong>Supports Expression Language: true (will be evaluated using variable registry only)</strong></td></tr><tr><td id="name">Password</td><td>Password</td><td></td><td id="allowable-values"></td><td id="description">Password to use when connecting to the broker<br/><strong>Sensitive Property: true</strong></td></tr><tr><td id="name">SSL Context Service</td><td>SSL Context Service</td><td></td><td id="allowable-values"><strong>Controller Service API: </strong><br/>SSLContextService<br/><strong>Implementations: </strong><a href="../../../nifi-ssl-context-service-nar/1.19.1/org.apache.nifi.ssl.StandardRestrictedSSLContextService/index.html">StandardRestrictedSSLContextService</a><br/><a href="../../../nifi-ssl-context-service-nar/1.19.1/org.apache.nifi.ssl.StandardSSLContextService/index.html">StandardSSLContextService</a></td><td id="description">The SSL Context Service used to provide client certificate information for TLS/SSL connections.</td></tr><tr><td id="name"><strong>Session state</strong></td><td>Session state</td><td id="default-value">Clean Session</td><td id="allowable-values"><ul><li>Clean Session <img src="../../../../../html/images/iconInfo.png" alt="Client and Server discard any previous session and start a new one. This session lasts as long as the network connection. State data associated with this session is not reused in any subsequent session" title="Client and Server discard any previous session and start a new one. This session lasts as long as the network connection. State data associated with this session is not reused in any subsequent session"></img></li><li>Resume Session <img src="../../../../../html/images/iconInfo.png" alt="Server resumes communications with the client based on state from the current session (as identified by the ClientID). The client and server store the session after the client and server are disconnected. After the disconnection of a session that was not a clean session, the server stores further QoS 1 and QoS 2 messages that match any subscriptions that the client had at the time of disconnection as part of the session state" title="Server resumes communications with the client based on state from the current session (as identified by the ClientID). The client and server store the session after the client and server are disconnected. After the disconnection of a session that was not a clean session, the server stores further QoS 1 and QoS 2 messages that match any subscriptions that the client had at the time of disconnection as part of the session state"></img></li></ul></td><td id="description">Whether to start a fresh or resume previous flows. See the allowable value descriptions for more details.</td></tr><tr><td id="name">Session Expiry Interval</td><td>Session Expiry Interval</td><td id="default-value">24 hrs</td><td id="allowable-values"></td><td id="description">After this interval the broker will expire the client and clear the session state.<br/><br/><strong>This Property is only considered if all of the following conditions are met:</strong><ul><li>The [MQTT Specification Version] Property has a value of "v5.0".</li><li>The [Session state] Property has a value of "Resume Session".</li></ul></td></tr><tr><td id="name">Client ID</td><td>Client ID</td><td></td><td id="allowable-values"></td><td id="description">MQTT client ID to use. If not set, a UUID will be generated.<br/><strong>Supports Expression Language: true (will be evaluated using variable registry only)</strong></td></tr><tr><td id="name"><strong>Topic</strong></td><td>Topic</td><td></td><td id="allowable-values"></td><td id="description">The topic to publish the message to.<br/><strong>Supports Expression Language: true (will be evaluated using flow file attributes and variable registry)</strong></td></tr><tr><td id="name"><strong>Retain Message</strong></td><td>Retain Message</td><td></td><td id="allowable-values"></td><td id="description">Whether or not the retain flag should be set on the MQTT message.<br/><strong>Supports Expression Language: true (will be evaluated using flow file attributes and variable registry)</strong></td></tr><tr><td id="name"><strong>Quality of Service (QoS)</strong></td><td>Quality of Service(QoS)</td><td></td><td id="allowable-values"></td><td id="description">The Quality of Service (QoS) to send the message with. Accepts three values '0', '1' and '2'; '0' for 'at most once', '1' for 'at least once', '2' for 'exactly once'. Expression language is allowed in order to support publishing messages with different QoS but the end value of the property must be either '0', '1' or '2'. <br/><strong>Supports Expression Language: true (will be evaluated using flow file attributes and variable registry)</strong></td></tr><tr><td id="name">Record Reader</td><td>record-reader</td><td></td><td id="allowable-values"><strong>Controller Service API: </strong><br/>RecordReaderFactory<br/><strong>Implementations: </strong><a href="../../../nifi-record-serialization-services-nar/1.19.1/org.apache.nifi.grok.GrokReader/index.html">GrokReader</a><br/><a href="../../../nifi-record-serialization-services-nar/1.19.1/org.apache.nifi.xml.XMLReader/index.html">XMLReader</a><br/><a href="../../../nifi-record-serialization-services-nar/1.19.1/org.apache.nifi.avro.AvroReader/index.html">AvroReader</a><br/><a href="../../../nifi-record-serialization-services-nar/1.19.1/org.apache.nifi.syslog.Syslog5424Reader/index.html">Syslog5424Reader</a><br/><a href="../../../nifi-record-serialization-services-nar/1.19.1/org.apache.nifi.cef.CEFReader/index.html">CEFReader</a><br/><a href="../../../nifi-record-serialization-services-nar/1.19.1/org.apache.nifi.syslog.SyslogReader/index.html">SyslogReader</a><br/><a href="../../../nifi-record-serialization-services-nar/1.19.1/org.apache.nifi.json.JsonTreeReader/index.html">JsonTreeReader</a><br/><a href="../../../nifi-record-serialization-services-nar/1.19.1/org.apache.nifi.csv.CSVReader/index.html">CSVReader</a><br/><a href="../../../nifi-scripting-nar/1.19.1/org.apache.nifi.record.script.ScriptedReader/index.html">ScriptedReader</a><br/><a href="../../../nifi-parquet-nar/1.19.1/org.apache.nifi.parquet.ParquetReader/index.html">ParquetReader</a><br/><a href="../../../nifi-record-serialization-services-nar/1.19.1/org.apache.nifi.json.JsonPathReader/index.html">JsonPathReader</a><br/><a href="../../../nifi-record-serialization-services-nar/1.19.1/org.apache.nifi.lookup.ReaderLookup/index.html">ReaderLookup</a><br/><a href="../../../nifi-record-serialization-services-nar/1.19.1/org.apache.nifi.windowsevent.WindowsEventLogReader/index.html">WindowsEventLogReader</a></td><td id="description">The Record Reader to use for parsing the incoming FlowFile into Records.</td></tr><tr><td id="name">Record Writer</td><td>record-writer</td><td></td><td id="allowable-values"><strong>Controller Service API: </strong><br/>RecordSetWriterFactory<br/><strong>Implementations: </strong><a href="../../../nifi-record-serialization-services-nar/1.19.1/org.apache.nifi.text.FreeFormTextRecordSetWriter/index.html">FreeFormTextRecordSetWriter</a><br/><a href="../../../nifi-record-serialization-services-nar/1.19.1/org.apache.nifi.avro.AvroRecordSetWriter/index.html">AvroRecordSetWriter</a><br/><a href="../../../nifi-scripting-nar/1.19.1/org.apache.nifi.record.script.ScriptedRecordSetWriter/index.html">ScriptedRecordSetWriter</a><br/><a href="../../../nifi-record-serialization-services-nar/1.19.1/org.apache.nifi.csv.CSVRecordSetWriter/index.html">CSVRecordSetWriter</a><br/><a href="../../../nifi-record-serialization-services-nar/1.19.1/org.apache.nifi.xml.XMLRecordSetWriter/index.html">XMLRecordSetWriter</a><br/><a href="../../../nifi-parquet-nar/1.19.1/org.apache.nifi.parquet.ParquetRecordSetWriter/index.html">ParquetRecordSetWriter</a><br/><a href="../../../nifi-record-serialization-services-nar/1.19.1/org.apache.nifi.json.JsonRecordSetWriter/index.html">JsonRecordSetWriter</a><br/><a href="../../../nifi-record-serialization-services-nar/1.19.1/org.apache.nifi.lookup.RecordSetWriterLookup/index.html">RecordSetWriterLookup</a></td><td id="description">The Record Writer to use for serializing Records before publishing them as an MQTT Message.</td></tr><tr><td id="name">Message Demarcator</td><td>message-demarcator</td><td></td><td id="allowable-values"></td><td id="description">With this property, you have an option to publish multiple messages from a single FlowFile. This property allows you to provide a string (interpreted as UTF-8) to use for demarcating apart the FlowFile content. This is an optional property ; if not provided, and if not defining a Record Reader/Writer, each FlowFile will be published as a single message. To enter special character such as 'new line' use CTRL+Enter or Shift+Enter depending on the OS.<br/><strong>Supports Expression Language: true (will be evaluated using variable registry only)</strong></td></tr><tr><td id="name">Connection Timeout (seconds)</td><td>Connection Timeout (seconds)</td><td id="default-value">30</td><td id="allowable-values"></td><td id="description">Maximum time interval the client will wait for the network connection to the MQTT server to be established. The default timeout is 30 seconds. A value of 0 disables timeout processing meaning the client will wait until the network connection is made successfully or fails.</td></tr><tr><td id="name">Keep Alive Interval (seconds)</td><td>Keep Alive Interval (seconds)</td><td id="default-value">60</td><td id="allowable-values"></td><td id="description">Defines the maximum time interval between messages sent or received. It enables the client to detect if the server is no longer available, without having to wait for the TCP/IP timeout. The client will ensure that at least one message travels across the network within each keep alive period. In the absence of a data-related message during the time period, the client sends a very small "ping" message, which the server will acknowledge. A value of 0 disables keepalive processing in the client.</td></tr><tr><td id="name">Last Will Message</td><td>Last Will Message</td><td></td><td id="allowable-values"></td><td id="description">The message to send as the client's Last Will.</td></tr><tr><td id="name"><strong>Last Will Topic</strong></td><td>Last Will Topic</td><td></td><td id="allowable-values"></td><td id="description">The topic to send the client's Last Will to.<br/><br/><strong>This Property is only considered if </strong><strong>the [Last Will Message] Property has a value specified.</strong></td></tr><tr><td id="name"><strong>Last Will Retain</strong></td><td>Last Will Retain</td><td id="default-value">false</td><td id="allowable-values"><ul><li>true</li><li>false</li></ul></td><td id="description">Whether to retain the client's Last Will.<br/><br/><strong>This Property is only considered if </strong><strong>the [Last Will Message] Property has a value specified.</strong></td></tr><tr><td id="name"><strong>Last Will QoS Level</strong></td><td>Last Will QoS Level</td><td id="default-value">0 - At most once</td><td id="allowable-values"><ul><li>0 - At most once <img src="../../../../../html/images/iconInfo.png" alt="Best effort delivery. A message won’t be acknowledged by the receiver or stored and redelivered by the sender. This is often called “fire and forget” and provides the same guarantee as the underlying TCP protocol." title="Best effort delivery. A message won’t be acknowledged by the receiver or stored and redelivered by the sender. This is often called “fire and forget” and provides the same guarantee as the underlying TCP protocol."></img></li><li>1 - At least once <img src="../../../../../html/images/iconInfo.png" alt="Guarantees that a message will be delivered at least once to the receiver. The message can also be delivered more than once" title="Guarantees that a message will be delivered at least once to the receiver. The message can also be delivered more than once"></img></li><li>2 - Exactly once <img src="../../../../../html/images/iconInfo.png" alt="Guarantees that each message is received only once by the counterpart. It is the safest and also the slowest quality of service level. The guarantee is provided by two round-trip flows between sender and receiver." title="Guarantees that each message is received only once by the counterpart. It is the safest and also the slowest quality of service level. The guarantee is provided by two round-trip flows between sender and receiver."></img></li></ul></td><td id="description">QoS level to be used when publishing the Last Will Message.<br/><br/><strong>This Property is only considered if </strong><strong>the [Last Will Message] Property has a value specified.</strong></td></tr></table><h3>Relationships: </h3><table id="relationships"><tr><th>Name</th><th>Description</th></tr><tr><td>success</td><td>FlowFiles that are sent successfully to the destination are transferred to this relationship.</td></tr><tr><td>failure</td><td>FlowFiles that failed to send to the destination are transferred to this relationship.</td></tr></table><h3>Reads Attributes: </h3>None specified.<h3>Writes Attributes: </h3>None specified.<h3>State management: </h3>This component does not store state.<h3>Restricted: </h3>This component is not restricted.<h3>Input requirement: </h3>This component requires an incoming relationship.<h3>System Resource Considerations:</h3><table id="system-resource-considerations"><tr><th>Resource</th><th>Description</th></tr><tr><td>MEMORY</td><td>An instance of this component can cause high usage of this system resource. Multiple instances or high concurrency settings may result a degradation of performance.</td></tr></table><h3>See Also:</h3><p><a href="../org.apache.nifi.processors.mqtt.ConsumeMQTT/index.html">ConsumeMQTT</a></p></body></html>