MQTT¶
Spout for MQTT
Bases: Spout
__init__(output, state, **kwargs)
¶
Initialize the MQTT class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
output |
StreamingOutput
|
An instance of the StreamingOutput class for saving the data. |
required |
state |
State
|
An instance of the State class for maintaining the state. |
required |
**kwargs |
Additional keyword arguments. |
{}
|
Using geniusrise to invoke via command line¶
genius MQTT rise \
streaming \
--output_kafka_topic mqtt_test \
--output_kafka_cluster_connection_string localhost:9094 \
none \
listen \
--args host=localhost port=1883 topic=my_topic
Using geniusrise to invoke via YAML file¶
listen(host='localhost', port=1883, topic='#', username=None, password=None)
¶
Start listening for data from the MQTT broker.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
host |
str
|
The MQTT broker host. Defaults to "localhost". |
'localhost'
|
port |
int
|
The MQTT broker port. Defaults to 1883. |
1883
|
topic |
str
|
The MQTT topic to subscribe to. Defaults to "#". |
'#'
|
username |
Optional[str]
|
The username for authentication. Defaults to None. |
None
|
password |
Optional[str]
|
The password for authentication. Defaults to None. |
None
|