github.com/argoproj/argo-events@v1.9.1/docs/sensors/triggers/kafka-trigger.md (about)

     1  # Kafka Trigger
     2  
     3  Kafka trigger allows sensor to publish events on Kafka topic. This trigger helps source the events from outside world into your messaging queues.
     4  
     5  ## Specification
     6  
     7  The Kafka trigger specification is available [here](https://github.com/argoproj/argo-events/blob/master/api/sensor.md#kafkatrigger).
     8  
     9  ## Walkthrough
    10  
    11  1. Consider a scenario where you are expecting a file drop onto a Minio bucket and want to place that event on a Kafka topic.
    12  
    13  1. Set up the Minio Event Source [here](https://argoproj.github.io/argo-events/setup/minio/).
    14     Do not create the Minio sensor, we are going to create it in next step.
    15  
    16  1. Lets create the sensor.
    17  
    18          apiVersion: argoproj.io/v1alpha1
    19          kind: Sensor
    20          metadata:
    21            name: minio-sensor
    22          spec:
    23            dependencies:
    24              - name: test-dep
    25                eventSourceName: minio
    26                eventName: example
    27            triggers:
    28              - template:
    29                  name: kafka-trigger
    30                  kafka:
    31                    # Kafka URL
    32                    url: kafka.argo-events.svc:9092
    33                    # Name of the topic
    34                    topic: minio-events
    35                    # partition id
    36                    partition: 0
    37                    payload:
    38                      - src:
    39                          dependencyName: test-dep
    40                          dataKey: notification.0.s3.object.key
    41                        dest: fileName
    42                      - src:
    43                          dependencyName: test-dep
    44                          dataKey: notification.0.s3.bucket.name
    45                        dest: bucket
    46  
    47  1. The Kafka message needs a body. In order to construct message based on the event data, sensor offers
    48     `payload` field as a part of the Kafka trigger.
    49  
    50     The `payload` contains the list of `src` which refers to the source event and `dest` which refers to destination key within result request payload.
    51  
    52     The `payload` declared above will generate a message body like below.
    53  
    54          {
    55              "fileName": "hello.txt" // name/key of the object
    56              "bucket": "input" // name of the bucket
    57          }
    58  
    59  1. Drop a file called `hello.txt` onto the bucket `input` and you will receive the message on Kafka topic