# SQS

The **SQS** component enables users to send messages to standard AWS SQS queues and to FIFO AWS SQS queues.

## Parameters

Take a look at the configuration options for the component. Parameters supported by [Double Braces expressions](https://docs.digibee.com/documentation/connectors-and-triggers/double-braces/overview) are marked with `(DB)`.

<table data-full-width="true"><thead><tr><th>Parameter</th><th>Description</th><th>Default value</th><th>Data type</th></tr></thead><tbody><tr><td><strong>Account</strong></td><td>For the component to make the authentication to AWS Cloud service, it's necessary to use a Basic type account. <a href="https://app.gitbook.com/s/jvO5S91EQURCEhbZOuuZ/platform-administration/settings/accounts#accounts-type">To know more about these accounts and other existing types, read the documentation</a></td><td>N/A</td><td>String</td></tr><tr><td><strong>Message</strong></td><td>The message body to be sent.</td><td>{{ message.$ }}</td><td>String</td></tr><tr><td><strong>Connection String</strong> <code>(DB)</code></td><td>The destination URL for the SQS queue in AWS.</td><td><a href="https://sqs.sa-east-1.amazonaws.com/838874755216/digibee-test">https://sqs.sa-east-1.amazonaws.com/838874755216/digibee-test</a></td><td>String</td></tr><tr><td><strong>Region</strong></td><td>The region where the AWS queue is registered.</td><td>South America (Sao Paulo)</td><td>String</td></tr><tr><td><strong>Queue Type</strong></td><td>The type of queue that will receive a message. It can be a Standard queue or a FIFO queue. If FIFO is selected, another parameter is necessary:</td><td>Standard</td><td>String</td></tr><tr><td><strong>Message Group ID</strong></td><td>For FIFO queues, this is the ID of a message group in this queue.</td><td>N/A</td><td>String</td></tr><tr><td><strong>Fail on Error</strong></td><td>When activated, this parameter suspends the pipeline execution. Otherwise, the pipeline execution proceeds, but the result will show a false value for the “success” property.</td><td>False</td><td>Boolean</td></tr></tbody></table>

## Messages flow

### Standard AWS SQS queues (without errors)

#### Payload

```json
{
    "queueTest": "MyTestQueue"
}
```

#### Input

```json
{
    "url": "https://sqs.sa-east-1.amazonaws.com/381492217694/{{message.queueTest}}",
    "typeQueue":"STANDARD",
    "messageBody": "{"test": "Test encryption"}",
    "region": "sa-east-1",
    "failOnError": false
}
```

#### Output

```json
{
    "messageId": "c959b1da-6650-46c2-8baf-62302789dd61",
    "messageBodyMD5": "c35f05f412ea94ef45bf103ba96b7b0e",
    "sequenceNumber": null,
    "success": true,
    "requestId": "6c950c3a-d081-5685-893b-55cf8c1b51e0"
}
```

### FIFO AWS SQS queues (without errors)

#### Input

```json
{
    "url": "https://sqs.sa-east-1.amazonaws.com/123456789012/digibee-test.fifo",
    "typeQueue":"FIFO",
    "messageGroupId":"mygroup",
    "messageBody": "{"test": "Test encryption"}",
    "region": "sa-east-1",
    "failOnError": false
}
```

#### Output

```json
{
    "messageId": "c959b1da-6650-46c2-8baf-62302789dd61",
    "messageBodyMD5": "c35f05f412ea94ef45bf103ba96b7b0e",
    "sequenceNumber": "18865425420279279616",
    "success": true,
    "requestId": "6c950c3a-d081-5685-893b-55cf8c1b51e0"
}
```

### FIFO AWS SQS queue (without messageGroupId):

#### Input

```json
{
    "url": "https://sqs.sa-east-1.amazonaws.com/123456789012/digibee-test.fifo",
    "typeQueue": "FIFO",
    "messageBody": "{"test": "Test encryption"}",
    "region": "sa-east-1",
    "failOnError": false
}
```

#### Output

```json
{
    "success": false,
    "message": "There is an invalid pipeline configuration",
    "error": "com.digibee.pipelineengine.exception.PipelineEngineConfigurationException: Configuration parameter 'messageGroupId' cannot be null for connector sqs-connector"
}
```

### AWS SQS queue (invalid region)

#### Input

```json
{
    "url": "https://sqs.sa-east-1.amazonaws.com/123456789012/digibee-test",
    "typeQueue": "STANDARD",
    "messageBody": "{"test": "Test encryption"}",
    "region": "wrong-region",
    "failOnError": false
}
```

#### Output

```json
{
    "success": false,
    "message": "Something went wrong while trying to execute SQS CONNECTOR",
    "error": "com.amazonaws.services.sqs.model.AmazonSQSException: Credential should be scoped to a valid region, not 'wrong-region'. (Service: AmazonSQS; Status Code: 403; Error Code: SignatureDoesNotMatch; Request ID: bf47d091-2129-5320-a332-89647ef0d86b)"
}
```

[Read our article on Messages processing](https://app.gitbook.com/s/jvO5S91EQURCEhbZOuuZ/development-cycle/build-overview/pipelines/messages-processing) to understand how the Digibee Integration Platform processes message flow.
