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

     1  # AWS SQS
     2  
     3  SQS event-source listens to messages on AWS SQS queue and helps 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                   "messageId": "message id",
    21                   // Each message attribute consists of a Name, Type, and Value. For more information,
    22                   // see Amazon SQS Message Attributes
    23                   // (https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-message-attributes.html)
    24                   // in the Amazon Simple Queue Service Developer Guide.
    25                   "messageAttributes": "message attributes", 
    26                     "body": "Body is the message data",
    27                  }
    28              }
    29  
    30  <br/>
    31  
    32  ## Setup
    33  
    34  1. Create a queue called `test` either using aws cli or AWS SQS management console.
    35  
    36  1. Fetch your access and secret key for AWS account and base64 encode them.
    37  
    38  1. Create a secret called `aws-secret` as follows.
    39  
    40          apiVersion: v1
    41          kind: Secret
    42          metadata:
    43            name: aws-secret
    44          type: Opaque
    45          data:
    46            accesskey: <base64-access-key>
    47            secretkey: <base64-secret-key>
    48  
    49  1. Deploy the secret.
    50  
    51          kubectl -n argo-events apply -f aws-secret.yaml
    52  
    53  1. Create the event source by running the following command.
    54  
    55          kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/event-sources/aws-sqs.yaml
    56  
    57  1. Inspect the event-source pod logs to make sure it was able to subscribe to the queue specified in the event source to consume messages.
    58  
    59  1. Create the sensor by running the following command.
    60  
    61          kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/sensors/aws-sqs.yaml
    62  
    63  1. Dispatch a message on sqs queue.
    64  
    65          aws sqs send-message --queue-url https://sqs.us-east-1.amazonaws.com/XXXXX/test --message-body '{"message": "hello"}'
    66  
    67  1. Once a message is published, an argo workflow will be triggered. Run `argo list` to find the workflow.
    68  
    69  ## Troubleshoot
    70  
    71  Please read the [FAQ](https://argoproj.github.io/argo-events/FAQ/).