You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: PROCESSORS.md
+15-5Lines changed: 15 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -392,7 +392,7 @@ In the list below, the names of required properties appear in bold. Any other pr
392
392
393
393
### Description
394
394
395
-
This Processor gets the contents of a FlowFile from a MQTT broker for a specified topic. The the payload of the MQTT message becomes content of a FlowFile
395
+
This Processor gets the contents of a FlowFile from a MQTT broker for a specified topic. The the payload of the MQTT message becomes content of a FlowFile. If Record Reader and Record Writer are set, then the MQTT message specific attributes are not set in the flow file, because different attributes can be set for different records. In this case if Add Attributes As Fields is set to true, the attributes will be added to each record as fields.
396
396
397
397
### Properties
398
398
@@ -411,6 +411,9 @@ In the list below, the names of required properties appear in bold. Any other pr
411
411
| Attribute From Content Type | | | Name of FlowFile attribute to be filled from content type of received message. MQTT 5.x only. |
412
412
| Topic Alias Maximum | 0 | | Maximum number of topic aliases to use. If set to 0, then topic aliases cannot be used. MQTT 5.x only. |
413
413
| Receive Maximum | 65535 | | Maximum number of unacknowledged messages allowed. MQTT 5.x only. |
414
+
| Record Reader | | | The Record Reader to use for parsing received MQTT Messages into Records. |
415
+
| Record Writer | | | The Record Writer to use for serializing Records before writing them to a FlowFile. |
416
+
| Add Attributes As Fields | true | true<br/>false | If setting this property to true, default fields are going to be added in each record: _topic, _qos, _isDuplicate, _isRetained. |
414
417
| **Quality of Service** | 0 | 0<br/>1<br/>2 | The Quality of Service (QoS) of messages. |
415
418
| Connection Timeout | 10 sec | | Maximum time interval the client will wait for the network connection to the MQTT broker |
416
419
| Keep Alive Interval | 60 sec | | Defines the maximum time interval between messages sent or received |
@@ -435,10 +438,15 @@ In the list below, the names of required properties appear in bold. Any other pr
| mqtt.topic.segment.n | | The nth topic segment of the message |
446
+
| mqtt.qos | | The quality of service for this message. |
447
+
| mqtt.isDuplicate | | Whether or not this message might be a duplicate of one which has already been received. |
448
+
| mqtt.isRetained | | Whether or not this message was from a current publisher, or was "retained" by the server as the last message published on the topic. |
449
+
| record.count | | The number of records received |
442
450
443
451
444
452
## ConsumeWindowsEventLog
@@ -2198,6 +2206,8 @@ In the list below, the names of required properties appear in bold. Any other pr
2198
2206
| Retain | false | true<br/>false | Retain published message in broker |
2199
2207
| Message Expiry Interval | | | Time while message is valid and will be forwarded by broker. MQTT 5.x only. |
2200
2208
| Content Type | | | Content type of the message. MQTT 5.x only.<br/>**Supports Expression Language: true** |
2209
+
| Record Reader | | | The Record Reader to use for parsing the incoming FlowFile into Records. |
2210
+
| Record Writer | | | The Record Writer to use for serializing Records before publishing them as an MQTT Message. |
2201
2211
| **Quality of Service** | 0 | 0<br/>1<br/>2 | The Quality of Service (QoS) of messages. |
2202
2212
| Connection Timeout | 10 sec | | Maximum time interval the client will wait for the network connection to the MQTT broker |
2203
2213
| Keep Alive Interval | 60 sec | | Defines the maximum time interval between messages sent or received |
Copy file name to clipboardExpand all lines: docker/test/integration/features/mqtt.feature
+53Lines changed: 53 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -90,8 +90,10 @@ Feature: Sending data to MQTT streaming platform using PublishMQTT
90
90
And a ConsumeMQTT processor set up to communicate with an MQTT broker instance
91
91
And the "MQTT Version" property of the ConsumeMQTT processor is set to "<version>"
92
92
And a PutFile processor with the "Directory" property set to "/tmp/output"
93
+
And a LogAttribute processor
93
94
And "ConsumeMQTT" processor is a start node
94
95
And the "success" relationship of the ConsumeMQTT processor is connected to the PutFile
96
+
And the "success" relationship of the PutFile processor is connected to the LogAttribute
95
97
96
98
And an MQTT broker is set up in correspondence with the PublishMQTT and ConsumeMQTT
97
99
@@ -101,6 +103,12 @@ Feature: Sending data to MQTT streaming platform using PublishMQTT
101
103
And a file with the content "test" is placed in "/tmp/input"
102
104
And a flowfile with the content "test" is placed in the monitored directory in less than 60 seconds
103
105
And the MQTT broker has a log line matching "Received PUBLISH from .*testtopic.*\(4 bytes\)"
106
+
And the Minifi logs contain the following message: "key:mqtt.broker value:mqtt-broker-" in less than 60 seconds
107
+
And the Minifi logs contain the following message: "key:mqtt.topic value:testtopic" in less than 1 seconds
108
+
And the Minifi logs contain the following message: "key:mqtt.topic.segment.0 value:testtopic" in less than 1 seconds
109
+
And the Minifi logs contain the following message: "key:mqtt.qos value:0" in less than 1 seconds
110
+
And the Minifi logs contain the following message: "key:mqtt.isDuplicate value:false" in less than 1 seconds
111
+
And the Minifi logs contain the following message: "key:mqtt.isRetained value:false" in less than 1 seconds
104
112
105
113
Examples: MQTT versions
106
114
| version |
@@ -505,3 +513,48 @@ Feature: Sending data to MQTT streaming platform using PublishMQTT
505
513
And "publisher-client" flow is killed
506
514
And the MQTT broker has a log line matching "Sending PUBLISH to consumer-client"
507
515
And a flowfile with the content "last_will_message" is placed in the monitored directory in less than 60 seconds
516
+
517
+
Scenario: A MiNiFi instance uses record reader and writer to convert consumed message from an MQTT broker
518
+
Given a XMLReader controller service is set up
519
+
And a JsonRecordSetWriter controller service is set up with "Array" output grouping
520
+
And a ConsumeMQTT processor with the "Topic" property set to "test/my/topic"
521
+
And the "MQTT Version" property of the ConsumeMQTT processor is set to "3.x AUTO"
522
+
And the "Record Reader" property of the ConsumeMQTT processor is set to "XMLReader"
523
+
And the "Record Writer" property of the ConsumeMQTT processor is set to "JsonRecordSetWriter"
524
+
And a PutFile processor with the "Directory" property set to "/tmp/output"
525
+
And a LogAttribute processor
526
+
And the "success" relationship of the ConsumeMQTT processor is connected to the PutFile
527
+
And the "success" relationship of the PutFile processor is connected to the LogAttribute
528
+
And an MQTT broker is set up in correspondence with the ConsumeMQTT
529
+
530
+
When both instances start up
531
+
And a test message "<root><element>test</element></root>" is published to the MQTT broker on topic "test/my/topic"
532
+
533
+
Then the MQTT broker has a log line matching "Received SUBSCRIBE from consumer-client"
534
+
And a flowfile with the JSON content '[{"_isRetained": false, "_isDuplicate": false, "_qos": 0, "_topicSegments": ["test", "my", "topic"], "_topic": "test/my/topic", "element": "test"}]' is placed in the monitored directory in less than 60 seconds
535
+
And the Minifi logs contain the following message: "key:record.count value:1" in less than 60 seconds
536
+
And the Minifi logs contain the following message: "key:mqtt.broker value:mqtt-broker-" in less than 1 seconds
537
+
538
+
Scenario: A MiNiFi instance uses record reader and writer to convert and publish records to an MQTT broker
539
+
Given a JsonTreeReader controller service is set up
540
+
And a XMLRecordSetWriter controller service is set up
541
+
And the "Name of Record Tag" property of the XMLRecordSetWriter controller is set to "record"
542
+
And the "Name of Root Tag" property of the XMLRecordSetWriter controller is set to "root"
543
+
And a GetFile processor with the "Input Directory" property set to "/tmp/input"
544
+
And a file with the content '[{"string": "test"}, {"int": 42}]' is present in '/tmp/input'
545
+
And a PublishMQTT processor set up to communicate with an MQTT broker instance
546
+
And the "MQTT Version" property of the PublishMQTT processor is set to "3.x AUTO"
547
+
And the "Record Reader" property of the PublishMQTT processor is set to "JsonTreeReader"
548
+
And the "Record Writer" property of the PublishMQTT processor is set to "XMLRecordSetWriter"
549
+
And a UpdateAttribute processor with the "filename" property set to "${UUID()}.xml"
550
+
And a PutFile processor with the "Directory" property set to "/tmp/output"
551
+
And the "success" relationship of the GetFile processor is connected to the PublishMQTT
552
+
And the "success" relationship of the PublishMQTT processor is connected to the UpdateAttribute
553
+
And the "success" relationship of the UpdateAttribute processor is connected to the PutFile
554
+
And an MQTT broker is set up in correspondence with the PublishMQTT
555
+
556
+
When both instances start up
557
+
558
+
Then two flowfiles with the contents '<?xml version="1.0"?><root><record><string>test</string></record></root>' and '<?xml version="1.0"?><root><record><int>42</int></record></root>' are placed in the monitored directory in less than 60 seconds
559
+
And the MQTT broker has a log line matching "Received PUBLISH from .*testtopic.*\(72 bytes\)"
560
+
And the MQTT broker has a log line matching "Received PUBLISH from .*testtopic.*\(64 bytes\)"
0 commit comments