github.com/argoproj/argo-events@v1.9.1/docs/eventsources/setup/mqtt.md (about)

     1  # MQTT
     2  
     3  The event-source listens to messages over MQTT and helps sensor trigger the workloads.  
     4  
     5  ## Event Structure
     6  
     7  The structure of an event dispatched by the event-source over the eventbus looks like following,
     8  
     9          {
    10              "context": {
    11                 "type": "type_of_event_source",
    12                 "specversion": "cloud_events_version",
    13                 "source": "name_of_the_event_source",
    14                 "id": "unique_event_id",
    15                 "time": "event_time",
    16                 "datacontenttype": "type_of_data",
    17                 "subject": "name_of_the_configuration_within_event_source"
    18              },
    19              "data": {
    20                  "topic": "Topic refers to the MQTT topic name",
    21                  "messageId": "MessageId is the unique ID for the message",
    22                  "body": "Body is the message payload"
    23              }
    24          }
    25  
    26  ## Specification
    27  
    28  MQTT event-source specification is available [here](https://github.com/argoproj/argo-events/blob/master/api/event-source.md#mqtteventsource).
    29  
    30  ## Setup
    31  
    32  1. Make sure to set up the MQTT Broker and Bridge in Kubernetes if you don't already have one.
    33  
    34  1. Create the event source by running the following command. Make sure to update the appropriate fields.
    35  
    36          kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/event-sources/mqtt.yaml
    37  
    38  1. Create the sensor by running the following command.
    39  
    40          kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/sensors/mqtt-sensor.yaml
    41  
    42  1. Send message by using MQTT client.
    43  
    44  1. Once a message is published, an argo workflow will be triggered. Run `argo list` to find the workflow.
    45  
    46  ## Troubleshoot
    47  
    48  Please read the [FAQ](https://argoproj.github.io/argo-events/FAQ/).