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

     1  # Kafka
     2  
     3  Kafka event-source listens to messages on topics and helps the sensor trigger 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": "kafka_topic",
    21                "partition": "partition_number",
    22                "body": "message_body",
    23                "timestamp": "timestamp_of_the_message"
    24              }
    25          }
    26  
    27  ## Specification
    28  
    29  Kafka event-source specification is available [here](https://github.com/argoproj/argo-events/blob/master/api/event-source.md#kafkaeventsource).
    30  
    31  ## Setup
    32  
    33  1. Make sure to set up the Kafka cluster in Kubernetes if you don't already have one. You can refer to <https://github.com/Yolean/kubernetes-kafka> for installation instructions.
    34  
    35  1. Create the event source by running the following command. Make sure to update the appropriate fields.
    36  
    37          kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/event-sources/kafka.yaml
    38  
    39  1. Create the sensor by running the following command.
    40  
    41          kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/sensors/kafka.yaml
    42  
    43  1. Send message by using Kafka client. More info on how to send message at <https://kafka.apache.org/quickstart>.
    44  
    45  1. Once a message is published, an argo workflow will be triggered. Run `argo list` to find the workflow.
    46  
    47  ## Troubleshoot
    48  
    49  Please read the [FAQ](https://argoproj.github.io/argo-events/FAQ/).