Using the MQTT Destination Component
The MQTT Destination component is an SSIS data flow pipeline component that can be used to send messages to an MQTT 1.0 compliant broker. There are three pages of configuration:
- General
- Columns
- Error Handling
General Page
- Connection Manager
-
The destination component requires an active connection to MQTT. The Connection Manager drop-down will show a list of all MQTT Connection Managers that have been created in the current SSIS package.
- Action
-
The Action specifies how you want to write to MQTT queue service. There are 2 Actions:
- Create
- Delete
- Topic
-
The target topic of the messages which will be sent to your MQTT server.
- Retained
-
Specify if the message is retained for a topic. Broker may only store one retained message for a topic.
- Body Column Type
-
The Body Column Type allows you to specify whether you want to write the binary content of the message or the text content of the message to MQTT. There are two different modes available for Message column types: Binary and Text. The default setting is Text.
- Encoding
-
The encoding that will be used to convert the message body to a byte array when sending the message. This option is only available when Message Column Type is Text.
- Refresh Component Button
-
Clicking the Refresh Component button causes the component to retrieve the latest metadata and update each field to its most recent metadata. It will remove any custom fields that have been added on the columns page.
- Map Unmapped Fields Button
-
By clicking this button, the component will try to map any unmapped attributes by matching their names with the input columns from upstream components. This is useful when your source component has recently added more columns, in which case you can use this button to automatically establish the association between input columns and unmapped destination attributes.
- Clear All Mappings Button
-
By clicking this button, the component will reset all your mappings in the destination component.
Columns Page
The Columns page allows you to map the columns from upstream components to destination attributes.
In the Columns page, you will see a grid as shown below.
- Input Column: You can select an input column from an upstream component here.
- MQTT Field: The attribute/field that you want to write data to.
- Data Type: This column indicates the type of value for the current attribute.
- Unmap: This button provides a convenient way to unset the mapping for the selected attribute/field.
Error Handling Page
The Error Handling page allows you to specify how errors should be handled when they happen.
There are three options available:
- Fail on error
- Redirect rows to error output
- Ignore error
When the Redirect rows to error output option is selected, rows that failed to write to MQTT will be redirected to the 'Error Output' of the Destination Component. As indicated in the screenshot below, the green output connection represent rows that were successfully written, and the red 'Error Output' connection represents rows that were erroneous. The 'ErrorMessage' output column found in the 'Error Output' may contain the error message that was reported by MQTT or the component itself.
Note: Use extra caution when selecting Ignore error option, since the component will remain silent for any errors that have occurred.