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

     1  # Emitter
     2  
     3  Emitter event-source subscribes to a channel 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": "name_of_the_topic",
    21                "body": "message_payload"
    22              }
    23          }
    24  
    25  ## Specification
    26  
    27  Emitter event-source specification is available [here](https://github.com/argoproj/argo-events/blob/master/api/event-source.md#emittereventsource).
    28  
    29  ## Setup
    30  
    31  1. Deploy the emitter in your local K8s cluster.
    32  
    33          ---
    34          apiVersion: v1
    35          kind: Service
    36          metadata:
    37            name: broker
    38            labels:
    39              app: broker
    40          spec:
    41            clusterIP: None
    42            ports:
    43              - port: 4000
    44                targetPort: 4000
    45            selector:
    46              app: broker
    47          ---
    48          apiVersion: apps/v1
    49          kind: Deployment
    50          metadata:
    51            name: broker
    52          spec:
    53            replicas: 1
    54            selector:
    55              matchLabels:
    56                app: broker
    57            template:
    58              metadata:
    59                labels:
    60                  app: broker
    61              spec:
    62                containers:
    63                  - env:
    64                      - name: EMITTER_LICENSE
    65                        value: "zT83oDV0DWY5_JysbSTPTDr8KB0AAAAAAAAAAAAAAAI" # This is a test license, DO NOT USE IN PRODUCTION!
    66                      - name: EMITTER_CLUSTER_SEED
    67                        value: "broker"
    68                      - name: EMITTER_CLUSTER_ADVERTISE
    69                        value: "private:4000"
    70                    name: broker
    71                    image: emitter/server:latest
    72                    ports:
    73                      - containerPort: 8080
    74                      - containerPort: 443
    75                      - containerPort: 4000
    76                    volumeMounts:
    77                      - name: broker-volume
    78                        mountPath: /data
    79                volumes:
    80                  - name: broker-volume
    81                    hostPath:
    82                      path: /emitter #directory on host
    83  
    84  1. Create the event-source by running the following command.
    85  
    86          kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/event-sources/emitter.yaml
    87  
    88  1. Inspect the event-source pod logs to make sure it was able to subscribe to the topic specified in the event source to consume messages.
    89  
    90  1. Create the sensor by running the following command.
    91  
    92          kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/sensors/emitter.yaml
    93  
    94  1. Send a message on emitter channel using one of the clients <https://emitter.io/develop/golang/>.
    95  
    96  1. Once a message is published, an argo workflow will be triggered. Run `argo list` to find the workflow.
    97  
    98  ## Troubleshoot
    99  
   100  Please read the [FAQ](https://argoproj.github.io/argo-events/FAQ/).