# MQTT Producer

The MQTT Producer step allows you to publish messages in near real time to an MQTT broker. Within a transformation, the MQTT Producer step publishes a [stream of records](/pdia-data-integration/extracting-data-into-pdi/streaming-analytics.md) to one MQTT topic.

For more information about the MQTT protocol, see <https://www.hivemq.com/mqtt/>.

![MQTT Producer step dialog](/files/XMn4TwO2llkjznK0UBzR)

### Step name

* **Step name**: Specifies the unique name of the step on the canvas. Default: `MQTT Producer`.

### Options

The MQTT Producer step includes the following tabs.

* **Setup**
* **Security**
* **Options**

#### Setup tab

In this tab, define the connection to the MQTT server, the topic for publishing, the Quality of Service level, and the message field.

| Option                       | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| ---------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Connection**               | Specify the address of the MQTT server to which this step will connect for sending or receiving messages.                                                                                                                                                                                                                                                                                                                                                                                                                              |
| **Client ID**                | Specify a unique ID for the MQTT client. The MQTT server uses this client ID to recognize each distinct client and that client's current state.                                                                                                                                                                                                                                                                                                                                                                                        |
| **Topic**                    | <p>Specify the topic name using one of the following methods:</p><ul><li><strong>Specify topic</strong>: Enter a specific topic name in <strong>Topic name</strong>. Each MQTT Producer step starts a single thread for publishing.</li><li><strong>Get data from field</strong>: Select a field name from another step in the transformation stream. Use this option to dynamically control the topic name. Each message still has only one topic, but each incoming row can generate a new message with a different topic.</li></ul> |
| **Quality of Service (QoS)** | <p>Quality of Service (QoS) is a level of guarantee for message delivery. Select one of the following options:</p><ul><li>At most once (0) (default)</li><li>At least once (1)</li><li>Exactly once (2)</li></ul>                                                                                                                                                                                                                                                                                                                      |
| **Message field**            | Select the field that contains the message to publish.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |

#### Security tab

![MQTT Producer step Security tab](/files/OU1nTEbG8qkFARz5SYxz)

Use this tab to define authentication credentials for the MQTT server.

| Option                  | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Username**            | Specify the user name required to access the MQTT server.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| **Password**            | Specify the password associated with the user name.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| **Use secure protocol** | Select this option to define SSL properties for the connection.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| **SSL Properties**      | <ul><li><strong>ssl.contextProvider</strong></li></ul><p>Specify the underlying JSSE provider.</p><ul><li><strong>ssl.enabledCipherSuites</strong></li></ul><p>Specify which ciphers are enabled. Values are dependent on the provider.</p><ul><li><strong>ssl.keyManager</strong></li></ul><p>Specify the algorithm that will be used to create a KeyManagerFactory object instead of using the default algorithm available in the platform.</p><ul><li><strong>ssl.keyStore</strong></li></ul><p>Specify the name of the file that contains the KeyStore object that you want the KeyManager to use.</p><ul><li><strong>ssl.keyStorePassword</strong></li></ul><p>Specify the password for the KeyStore object that you want the KeyManager to use.</p><ul><li><strong>ssl.keyStoreProvider</strong></li></ul><p>Specify the identifying name or string for the key store provider.</p><ul><li><strong>ssl.keyStoreType</strong></li></ul><p>Specify the identifying name or string for the type of key store.</p><ul><li><strong>ssl.protocol</strong></li></ul><p>Specify the type of SSL protocol to use.</p><ul><li><strong>ssl.trustManager</strong></li></ul><p>Specify the algorithm that will be used to create a TrustManagerFactory object, instead of using the default algorithm available in the platform.</p><ul><li><strong>ssl.trustStore</strong></li></ul><p>Specify the name of the file that contains the KeyStore object that you want the TrustManager to use.</p><ul><li><strong>ssl.trustStorePassword</strong></li></ul><p>Specify the password for the TrustStore object that you want the TrustManager to use.</p><ul><li><strong>ssl.trustStoreProvider</strong></li></ul><p>Specify the identifier or string for the trust store provider.</p><ul><li><strong>ssl.trustStoreType</strong></li></ul><p>Specify the type of KeyStore object that you want the TrustManager to use.</p> |

#### Options tab

![MQTT Producer step Options tab](/files/BUenDx2T7paKVzCs3hka)

This tab includes the following MQTT-specific parameters.

| Parameter               | Description                                                                                                                                                                                                                                                                                                                                                                                                                        |
| ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Keep Alive Interval** | Specify a maximum number of interval seconds that is permitted to elapse between the point at which the PDI client finishes transmitting one control packet and the point it starts sending the next.                                                                                                                                                                                                                              |
| **Max Inflight**        | Specify the maximum number of messages to have in process at any given time.                                                                                                                                                                                                                                                                                                                                                       |
| **Connection Timeout**  | Specify the time (in seconds) to disconnect if a message is not received.                                                                                                                                                                                                                                                                                                                                                          |
| **Clean Session**       | <p>Specify whether the broker stores or purges messages for a session:</p><ul><li><strong><code>True</code></strong></li></ul><p>The broker does not store any information for the client. All information from a previous persistent session is purged.</p><ul><li><strong><code>False</code></strong></li></ul><p>The broker stores all subscriptions for the client. When QoS is set to 1 or 2, missed messages are stored.</p> |
| **Storage Level**       | <p>Indicates whether messages are stored in memory or on disk:</p><ul><li>Blank (default): memory</li><li>Disk: enter a valid path</li></ul>                                                                                                                                                                                                                                                                                       |
| **Server URIs**         | Specify the MQTT server universal resource identifier (URI).                                                                                                                                                                                                                                                                                                                                                                       |
| **MQTT Version**        | Specify the MQTT protocol version that this step connects to.                                                                                                                                                                                                                                                                                                                                                                      |
| **Automatic Reconnect** | <p>Enable the client to attempt an automatic reconnect to the server if it becomes disconnected:</p><ul><li><strong><code>True</code></strong>: reconnect to the server</li><li><strong><code>False</code></strong>: do not reconnect</li></ul>                                                                                                                                                                                    |

### Metadata injection support

This step supports metadata injection. You can use it with [ETL metadata injection](/pdia-data-integration/pdi-transformation-steps-reference-overview/etl-metadata-injection.md) to pass metadata to your transformation at runtime.

### See also

* [MQTT Consumer](/pdia-data-integration/pdi-transformation-steps-reference-overview/mqtt-consumer.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.pentaho.com/pdia-data-integration/pdi-transformation-steps-reference-overview/mqtt-producer.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
