---
schema_version: "1"
id: 35001f367d15ba165747d1a3cacb9557ee446db17f14049a51209b8d993f0073
title: Amazon SQS Connector 5.12 Examples
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/amazon-sqs-connector/latest/amazon-sqs-connector-examples.md
canonical_url: https://docs.mulesoft.com/amazon-sqs-connector/latest/amazon-sqs-connector-examples
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 03a88a652825dc45cd20fa20a3f2903a7d7c13c1063f766f3fec2e41381b7aa3
description: MuleSoft Documentation Site
release: "5.12"
latest: true
---
---
product: Amazon SQS Connector
version: 5.12
is-latest-version: true
---

# Amazon SQS Connector 5.12 Examples

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

The following examples show several Mule flows for Amazon SQS Connector:

- [Send and Receive Messages](#send-and-receive-messages)

- [Send and Receive Large Messages](#send-and-receive-large-messages)

## Send and Receive Messages

This example sends a message with metadata to an Amazon SQS queue and then receives the message from
the queue. The example contains two flows:

- The first flow sends a message with metadata and gets the count of the messages in the queue to
  validate that the message was sent.

- The second flow receives the message and logs the message body.

![Send and Receive Messages flows](/mulesoft/current/en-us/amazon-sqs-connector/latest/_images/amazon-sqs-message-flow.png)

### Configure the First Flow

Configure the first flow that sends a message to the queue. Creating the first flow involves
configuring a **Listener** component, a **Transform Message** component, a **Send message**
operation, a **Logger** component, a **Get approximate number of messages** operation, and a second
**Logger** component.

#### Configure the HTTP Listener

Configure the **Listener** component to initiate a Mule flow when a call is made to the `/` path:

1.  Create a new Mule project in Studio.

2.  From the **Mule Palette** view, select **HTTP** and drag the **Listener** component to the
    canvas.

3.  In the properties window, click **+** next to the **Connector configuration** field to add a
    global element.

4.  Accept the defaults.

5.  In the properties window, set the **Path** field value to `/`.

#### Add the Transform Message Component

Add the **Transform Message** component to attach the metadata and convert the values from the HTTP
input form to Java format so they can be used as input to the **Send message** operation:

1.  From the **Mule Palette** view, select **Core** and drag a **Transform Message** component to
    the right of **Listener**.

2.  In the properties window, overlay the brackets in the **Output** section with this DataWeave
    code:

    ```dataweave
    %dw 2.0
    output application/java
    ---
    {
    	delaySeconds: 0,
    	body: "Hello World",
    	messageAttributes: {
    		"AccountId": {
    			"stringValue" : "000123456",
    			"dataType" : "String.AccountId"
    		} as Object {
    			class: "org.mule.extension.sqs.api.model.MessageAttributeValue"
    		},
    		"NumberId": {
    			"stringValue" : "230.000000000000000001",
    			"dataType" : "Number"
    		} as Object {
    			class : "org.mule.extension.sqs.api.model.MessageAttributeValue"
    		}
    	} as Object {
    		class: "java.util.HashMap"
    	}
    } as Object {
    	class: "org.mule.extension.sqs.api.model.Message"
    }
    ```

#### Add the Send Message Operation

Add the **Send message** operation to send the message to the specified queue:

1.  From the **Mule Palette** view, select **Amazon SQS** and drag the **Send message** operation to
    the right of **Transform Message**.

2.  In the properties window, click **+** next to the **Connector configuration** field to add a
    global element.

3.  Configure the global element as follows:

    <table><colgroup><col> <col></colgroup><thead><tr><th>Field</th><th>Value</th></tr></thead><tbody><tr><td><p>Name</p></td><td><p>Name used to reference the configuration.</p></td></tr><tr><td><p>Session Token</p></td><td><p>Session token used to validate the temporary security credentials.</p></td></tr><tr><td><p>Access Key</p></td><td><p>Alphanumeric text string that uniquely identifies the user who owns the account.</p></td></tr><tr><td><p>Secret Key</p></td><td><p>Key that acts as a password.</p></td></tr><tr><td><p>Region Endpoint</p></td><td><p>Queue region.</p></td></tr><tr><td><p>SQS Endpoint</p></td><td><p>SQS endpoint for Amazon VPC support.</p></td></tr><tr><td><p>Default Global Queue URL</p></td><td><p>Default Amazon SQS queue URL credentials.</p></td></tr></tbody></table>

    The following image shows an example of the **Send Message** configuration of the global
    element:

    ![Send Message global element configuration window](/mulesoft/current/en-us/amazon-sqs-connector/latest/_images/amazon-sqs-studio-global-config-new.png)

4.  In the properties window, configure the following fields:

    <table><colgroup><col> <col></colgroup><thead><tr><th>Field</th><th>Value</th></tr></thead><tbody><tr><td><p>Display Name</p></td><td><p>Name for the connector operation.</p></td></tr><tr><td><p>Connector configuration</p></td><td><p>Global configuration you just created.</p></td></tr><tr><td><p>Message</p></td><td><p><code>payload</code></p></td></tr><tr><td><p>Queue url</p></td><td><p>Amazon SQS queue URL.</p><p>If provided, the value of this field takes precedence over the value of the <strong>Default Global Queue URL</strong> field on the <strong>Global Configuration Elements</strong> window.</p></td></tr></tbody></table>

    The following image shows an example of the **Send Message** configuration in the properties
    window:

    ![Send Message properties window configuration](/mulesoft/current/en-us/amazon-sqs-connector/latest/_images/amazon-sqs-send-message.png)

#### Add the First Logger Component

Add the first **Logger** component to display the response in the Mule console:

1.  From the **Mule Palette** view, select **Core** and drag a **Logger** component to the right of
    **Send message**.

2.  In the properties window, configure the following fields:

    <table><colgroup><col> <col></colgroup><thead><tr><th>Field</th><th>Value</th></tr></thead><tbody><tr><td><p>Display Name</p></td><td><p>Name for the logger, such as <code>Log Response</code>.</p></td></tr><tr><td><p>Message</p></td><td><p><code>Sent Message: `#[payload]`</code></p></td></tr><tr><td><p>Level</p></td><td><p>INFO (Default)</p></td></tr></tbody></table>

    The following image shows an example of the **Logger** configuration in the properties window:

    ![Logger properties window configuration](/mulesoft/current/en-us/amazon-sqs-connector/latest/_images/amazon-sqs-logger.png)

#### Add the Get Approximate Number of Messages Operation

Add the **Get approximate number of messages** operation to obtain the number of messages in the
queue:

1.  From the **Mule Palette** view, select **Amazon SQS** and drag the **Get approximate number of
    messages** operation to the right of **Logger**.

2.  In the properties window, configure the following fields:

    <table><colgroup><col> <col></colgroup><thead><tr><th>Field</th><th>Value</th></tr></thead><tbody><tr><td><p>Display Name</p></td><td><p>Name for the connector operation.</p></td></tr><tr><td><p>Connector configuration</p></td><td><p>Global configuration you just created.</p></td></tr><tr><td><p>Queue url</p></td><td><p><code>${sqs.queueUrl}</code></p></td></tr></tbody></table>

    The following image shows an example of the **Get approximate number of messages** configuration
    in the properties window:

    ![Get Approximate Number of Messages properties window configuration](/mulesoft/current/en-us/amazon-sqs-connector/latest/_images/amazon-sqs-get-message-count.png)

#### Add the Second Logger Component

Add the second **Logger** component to display the message count in the Mule console:

1.  From the **Mule Palette** view, select **Core** and drag a **Logger** component to the right of
    **Get approximate number of messages**.

2.  In the properties window, configure the following fields:

    <table><colgroup><col> <col></colgroup><thead><tr><th>Field</th><th>Value</th></tr></thead><tbody><tr><td><p>Display Name</p></td><td><p>Name for the logger, such as <code>Log Count</code>.</p></td></tr><tr><td><p>Message</p></td><td><p><code>Sent Message: `#[payload]`</code></p></td></tr><tr><td><p>Level</p></td><td><p>INFO (Default)</p></td></tr></tbody></table>

    The following image shows an example of the **Logger** configuration in the properties window:

    ![Logger properties window configuration](/mulesoft/current/en-us/amazon-sqs-connector/latest/_images/amazon-sqs-logger2.png)

### Configure the Second Flow

Configure the second flow that receives and logs the messages before the messages are deleted from
the queue. Creating the second flow involves configuring a **Receive messages** source and a
**Logger** component.

#### Add the Receive Messages Source

Add the **Receive messages** source to retrieve messages:

1.  From the **Mule Palette** view, select **Amazon SQS** and drag the **Receive messages** source
    to the canvas.

2.  In the properties window, configure the following fields:

    <table><colgroup><col> <col></colgroup><thead><tr><th>Field</th><th>Value</th></tr></thead><tbody><tr><td><p>Display Name</p></td><td><p>Name for the connector operation.</p></td></tr><tr><td><p>Connector configuration</p></td><td><p>Global configuration you just created.</p></td></tr><tr><td><p>Number of messages</p></td><td><p><code>1</code></p></td></tr><tr><td><p>Queue url</p></td><td><p>Amazon SQS queue URL.</p><p>If provided, the value of this field takes precedence over the value of the <strong>Default Global Queue URL</strong> field on the <strong>Global Configuration Elements</strong> window.</p></td></tr></tbody></table>

    The following image shows an example of the **Receive messages** configuration in the properties
    window:

    ![Receive Messages properties window configuration](/mulesoft/current/en-us/amazon-sqs-connector/latest/_images/amazon-sqs-receive-message.png)

#### Add the Logger Component

Add the **Logger** component to display the message in the Mule console:

1.  From the **Mule Palette** view, select **Core** and drag a **Logger** component to the right of
    **Receive messages**.

2.  In the properties window, configure the following fields:

    <table><colgroup><col> <col></colgroup><thead><tr><th>Field</th><th>Value</th></tr></thead><tbody><tr><td><p>Display Name</p></td><td><p>Name for the logger, such as <code>Log Receipt</code>.</p></td></tr><tr><td><p>Message</p></td><td><p><code>`#[payload]`</code></p></td></tr><tr><td><p>Level</p></td><td><p>INFO (Default)</p></td></tr></tbody></table>

    The following image shows an example of the **Logger** configuration in the properties window:

    ![Logger properties window configuration](/mulesoft/current/en-us/amazon-sqs-connector/latest/_images/amazon-sqs-logger-receive.png)

### XML for This Example

Paste this code into the Studio XML editor to quickly load the flow for this example into your Mule
app:

```xml
<mule xmlns:sqs="http://www.mulesoft.org/schema/mule/sqs" xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core"
	xmlns:http="http://www.mulesoft.org/schema/mule/http"
	xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd http://www.mulesoft.org/schema/mule/http
  http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
  http://www.mulesoft.org/schema/mule/ee/core
  http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd
  http://www.mulesoft.org/schema/mule/sqs
	http://www.mulesoft.org/schema/mule/sqs/current/mule-sqs.xsd">
	<http:listener-config name="HTTP_Listener_config" doc:name="HTTP Listener config" >
		<http:listener-connection host="0.0.0.0" port="8081" />
	</http:listener-config>
	<sqs:config name="Amazon_SQS_Configuration" doc:name="Amazon SQS Configuration"
	defaultQueueUrl="${sqs.queueUrl}" >
		<sqs:basic-connection accessKey="${sqs.accessKey}" secretKey="$sqs.secretKey}" region="us-east-1"/>
	</sqs:config>
	<flow name="sqs-send-messageFlow" >
		<http:listener doc:name="Listener"
		config-ref="HTTP_Listener_config"
		path="/"/>
		<ee:transform doc:name="Transform Message" >
			<ee:message >
				<ee:set-payload ><![CDATA[%dw 2.0
output application/java
---
{
	delaySeconds: 0,
	body: "Hello World",
	messageAttributes: {
		"AccountId": {
			"stringValue" : "000123456",
			"dataType" : "String.AccountId"
		} as Object {
			class: "org.mule.extension.sqs.api.model.MessageAttributeValue"
		},
		"NumberId": {
			"stringValue" : "230.000000000000000001",
			"dataType" : "Number"
		} as Object {
			class : "org.mule.extension.sqs.api.model.MessageAttributeValue"
		}
	} as Object {
		class: "java.util.HashMap"
	}
} as Object {
	class: "org.mule.extension.sqs.api.model.Message"
}]]></ee:set-payload>
			</ee:message>
		</ee:transform>
		<sqs:send-message doc:name="Send message"/>
		<logger level="INFO"
		doc:name="Log Response"
		message="payload"/>
		<sqs:get-approximate-number-of-messages
		doc:name="Get approximate number of messages"
		config-ref="Amazon_SQS_Configuration"
		queueUrl="${sqs.queueUrl}"/>
		<logger level="INFO" doc:name="Log Count"
		message="Sent Message: `#[payload]`"/>
	</flow>
	<flow name="sqs-receive-message-flow" >
		<sqs:receivemessages doc:name="Receive messages"
		config-ref="Amazon_SQS_Configuration"/>
		<logger level="INFO" doc:name="Log Receipt" />
	</flow>
</mule>
```

## Send and Receive Large Messages

> [!NOTE] Enabling this feature incurs additional charges associated with using AWS S3.

This example sends a large message with metadata to an Amazon SQS queue that references the AWS S3
bucket to use for storing large message payloads, and then receives the large message from the
queue. The example contains two flows:

- The first flow sends a large message with metadata and gets the count of the messages in the queue
  to validate that the large message was sent.

- The second flow receives the large message and logs the message body.

![Send and Receive Large Messages flows](/mulesoft/current/en-us/amazon-sqs-connector/latest/_images/amazon-sqs-large-message-flow.png)

### Before You Begin

Before you begin, you must have:

- Access to the Amazon SQS target resource and Anypoint Platform

- A file containing a payload larger than 256 KB

- An AWS S3 bucket created on AWS S3 to use for storing the large payload messages

- AWS Identity and Access Management (IAM) credentials

### Configure the First Flow

Configure the first flow that sends a large message to the queue. Creating the first flow involves
configuring a **Listener** component, a **Read** operation, a **Transform Message** component, a
**Send Message** operation, a **Logger** component, a **Get approximate number of messages**
operation, and a second **Logger** component.

#### Configure the HTTP Listener

Configure the **Listener** component to initiate a Mule flow when a call is made to the
`/largePayload` path:

1.  Create a new Mule project in Studio.

2.  From the **Mule Palette** view, select **HTTP** and drag the **Listener** component to the
    canvas.

3.  In the properties window, click **+** next to the **Connector configuration** field to add a
    global element.

4.  Accept the defaults.

5.  In the properties window, set the **Path** field value to `/largePayload`.

#### Add the Read Operation

Add the **Read** operation to read the large payload:

1.  From the **Mule Palette** view, select **File** and drag the **Read** operation to the right of
    **Listener**.

2.  In the properties window, click **+** next to the **Connector configuration** field to add a
    global element.

3.  Select the **Connection** checkbox.

4.  In **Working Directory**, enter the directory that will serve as the root directory for every
    relative path used with this connector.  
    The default is your user home directory.

    In this example, the file is read from `src/main/resources` of the Mule application:

    ![Working Directory configuration window for Read operation](/mulesoft/current/en-us/amazon-sqs-connector/latest/_images/amazon-sqs-file-global-config.png)

5.  In the properties window, configure the following fields:

    <table><colgroup><col> <col></colgroup><thead><tr><th>Field</th><th>Value</th></tr></thead><tbody><tr><td><p>Display Name</p></td><td><p>Name for the connector operation.</p></td></tr><tr><td><p>Connector configuration</p></td><td><p>Global configuration you just created.</p></td></tr><tr><td><p>File Path</p></td><td><p>Path to the file to read.</p></td></tr></tbody></table>

    The following image shows an example of the **Read** configuration in the properties window:

    ![Read properties window configuration](/mulesoft/current/en-us/amazon-sqs-connector/latest/_images/amazon-sqs-file-config.png)

#### Add the Transform Message Component

Add the **Transform Message** component to attach the metadata and convert the values from the HTTP
input form to Java format so they can be used as input to the **Send message** operation:

1.  From the **Mule Palette** view, select **Core** and drag a **Transform Message** component to
    the right of **Read**.

2.  In the properties window, overlay the brackets in the **Output** section with this DataWeave
    code:

    ```dataweave
    %dw 2.0
    output application/java
    ---
    {
    	delaySeconds: 0,
    	body: "Hello World",
    	messageAttributes: {
    		"AccountId": {
    			"stringValue" : "000123456",
    			"dataType" : "String.AccountId"
    		} as Object {
    			class: "org.mule.extension.sqs.api.model.MessageAttributeValue"
    		},
    		"NumberId": {
    			"stringValue" : "230.000000000000000001",
    			"dataType" : "Number"
    		} as Object {
    			class : "org.mule.extension.sqs.api.model.MessageAttributeValue"
    		}
    	} as Object {
    		class: "java.util.HashMap"
    	}
    } as Object {
    	class: "org.mule.extension.sqs.api.model.Message"
    }
    ```

#### Add the Send Message Operation

Add the **Send message** operation to send the large message to the specified queue:

1.  From the **Mule Palette** view, select **Amazon SQS** and drag the **Send message** operation to
    the right of **Transform Message**.

2.  In the properties window, click **+** next to the **Connector configuration** field to add a
    global element.

3.  Configure the global element as follows:

    <table><colgroup><col> <col></colgroup><thead><tr><th>Field</th><th>Value</th></tr></thead><tbody><tr><td><p>Name</p></td><td><p>Name used to reference the configuration.</p></td></tr><tr><td><p>Session Token</p></td><td><p>Session token used to validate the temporary security credentials.</p></td></tr><tr><td><p>Access Key</p></td><td><p>Alphanumeric text string that uniquely identifies the user who owns the account.</p></td></tr><tr><td><p>Secret Key</p></td><td><p>Key that acts as a password.</p></td></tr><tr><td><p>Region Endpoint</p></td><td><p>Queue region.</p></td></tr><tr><td><p>SQS Endpoint</p></td><td><p>SQS endpoint for Amazon VPC support.</p></td></tr><tr><td><p>Default Global Queue URL</p></td><td><p>Default Amazon SQS queue URL credentials.</p></td></tr></tbody></table>

    The following image shows an example of the **Send Message** configuration of the global
    element:

    ![Send Message global element configuration window](/mulesoft/current/en-us/amazon-sqs-connector/latest/_images/amazon-sqs-studio-global-config-new.png)

4.  In the **Connection** section, click the **Advanced** tab.

5.  In the **Large Payload Support** field, select one of the following:

    - **Expression or Bean reference**

    - **Edit inline**

      Configure the fields as follows:

      <table><colgroup><col> <col></colgroup><thead><tr><th>Field</th><th>Value</th></tr></thead><tbody><tr><td><p>Bucket</p></td><td><p>Name of the AWS S3 bucket to use for storing large message payloads. The bucket must already be created and configured in AWS S3. Enabling this feature incurs additional charges for using AWS S3.</p></td></tr><tr><td><p>Message Size Threshold</p></td><td><p>Message size threshold for storing message payloads in the AWS S3 bucket. The default value for message size threshold is 256 KB and the maximum threshold size value is 256 KB. The maximum message size is 2 GB.</p></td></tr><tr><td><p>Message Size Threshold Unit</p></td><td><p>Data unit for the message size threshold.</p></td></tr><tr><td><p>Custom S3 Endpoint</p></td><td><p>Amazon S3 endpoint URL for VPC support.</p></td></tr></tbody></table>

      The following image shows an example of the **Large Payload Support** fields configuration:

      ![Large Payload Support fields configuration window](/mulesoft/current/en-us/amazon-sqs-connector/latest/_images/amazon-sqs-studio-large-payload-support.png)

6.  In the properties window, configure the following fields:

    <table><colgroup><col> <col></colgroup><thead><tr><th>Field</th><th>Value</th></tr></thead><tbody><tr><td><p>Display Name</p></td><td><p>Name for the connector operation.</p></td></tr><tr><td><p>Connector configuration</p></td><td><p>Global configuration you just created.</p></td></tr><tr><td><p>Message</p></td><td><p><code>payload</code></p></td></tr><tr><td><p>Queue url</p></td><td><p>Amazon SQS queue URL.</p><p>If provided, the value of this field takes precedence over the value of the <strong>Default Global Queue URL</strong> field on the <strong>Global Configuration Elements</strong> window.</p></td></tr></tbody></table>

    The following image shows an example of the **Send Message** configuration in the properties
    window:

    ![Send Message properties window configuration](/mulesoft/current/en-us/amazon-sqs-connector/latest/_images/amazon-sqs-send-message.png)

#### Add the First Logger Component

Add the first **Logger** component to display the response in the Mule console:

1.  From the **Mule Palette** view, select **Core** and drag a **Logger** component to the right of
    **Send message**.

2.  In the properties window, configure the following fields:

    <table><colgroup><col> <col></colgroup><thead><tr><th>Field</th><th>Value</th></tr></thead><tbody><tr><td><p>Display Name</p></td><td><p>Name for the logger, such as <code>Log Response</code>.</p></td></tr><tr><td><p>Message</p></td><td><p><code>Sent Message: `#[payload]`</code></p></td></tr><tr><td><p>Level</p></td><td><p>INFO (Default)</p></td></tr></tbody></table>

    The following image shows an example of the **Logger** configuration in the properties window:

    ![Logger properties window configuration](/mulesoft/current/en-us/amazon-sqs-connector/latest/_images/amazon-sqs-logger.png)

#### Add the Get Approximate Number of Messages Operation

Add the **Get approximate number of messages** operation to obtain the number of messages in the
queue:

1.  From the **Mule Palette** view, select **Amazon SQS** and drag the **Get approximate number of
    messages** operation to the right of **Logger**.

2.  In the properties window, configure the following fields:

    <table><colgroup><col> <col></colgroup><thead><tr><th>Field</th><th>Value</th></tr></thead><tbody><tr><td><p>Display Name</p></td><td><p>Name for the connector operation.</p></td></tr><tr><td><p>Connector configuration</p></td><td><p>Global configuration you just created.</p></td></tr><tr><td><p>Queue url</p></td><td><p><code>${sqs.queueUrl}</code></p></td></tr></tbody></table>

    The following image shows an example of the **Get approximate number of messages** configuration
    in the properties window:

    ![Get Approximate Number of Messages properties window configuration](/mulesoft/current/en-us/amazon-sqs-connector/latest/_images/amazon-sqs-get-message-count.png)

#### Add the Second Logger Component

Add the second **Logger** component to display the message count in the Mule console:

1.  From the **Mule Palette** view, select **Core** and drag a **Logger** component to the right of
    **Get approximate number of messages**.

2.  In the properties window, configure the following fields:

    <table><colgroup><col> <col></colgroup><thead><tr><th>Field</th><th>Value</th></tr></thead><tbody><tr><td><p>Display Name</p></td><td><p>Name for the logger, such as <code>Log Count</code>.</p></td></tr><tr><td><p>Message</p></td><td><p><code>Sent Message: `#[payload]`</code></p></td></tr><tr><td><p>Level</p></td><td><p>INFO (Default)</p></td></tr></tbody></table>

    The following image shows an example of the **Logger** configuration in the properties window:

    ![Logger properties window configuration](/mulesoft/current/en-us/amazon-sqs-connector/latest/_images/amazon-sqs-logger2.png)

### Configure the Second Flow

Configure the second flow that receives and logs the large messages before the large messages are
deleted from the queue. Creating the second flow involves configuring a **Receive messages** source
and a **Logger** component.

#### Add the Receive Messages Source

Add the **Receive messages** source to retrieve large messages:

1.  From the **Mule Palette** view, select **Amazon SQS** and drag the **Receive messages** source
    to the canvas.

2.  In the properties window, configure the following fields:

    <table><colgroup><col> <col></colgroup><thead><tr><th>Field</th><th>Value</th></tr></thead><tbody><tr><td><p>Display Name</p></td><td><p>Name for the connector operation.</p></td></tr><tr><td><p>Connector configuration</p></td><td><p>Global configuration you just created.</p></td></tr><tr><td><p>Number of messages</p></td><td><p><code>1</code></p></td></tr><tr><td><p>Queue url</p></td><td><p>Amazon SQS queue URL.</p><p>If provided, the value of this field takes precedence over the value of the <strong>Default Global Queue URL</strong> field on the <strong>Global Configuration Elements</strong> window.</p></td></tr></tbody></table>

    The following image shows an example of the **Receive messages** configuration in the properties
    window:

    ![Receive Messages properties window configuration](/mulesoft/current/en-us/amazon-sqs-connector/latest/_images/amazon-sqs-receive-message.png)

#### Add the Logger Component

Add the **Logger** component to display the large message in the Mule console:

1.  From the **Mule Palette** view, select **Core** and drag a **Logger** component to the right of
    **Receive messages**.

2.  In the properties window, configure the following fields:

    <table><colgroup><col> <col></colgroup><thead><tr><th>Field</th><th>Value</th></tr></thead><tbody><tr><td><p>Display Name</p></td><td><p>Name for the logger, such as <code>Log Receipt</code>.</p></td></tr><tr><td><p>Message</p></td><td><p><code>`#[payload]`</code></p></td></tr><tr><td><p>Level</p></td><td><p>INFO (Default)</p></td></tr></tbody></table>

    The following image shows an example of the **Logger** configuration in the properties window:

    ![Logger properties window configuration](/mulesoft/current/en-us/amazon-sqs-connector/latest/_images/amazon-sqs-logger-receive.png)

### XML for This Example

Paste this code into the Studio XML editor to quickly load the flow for this example into your Mule
app:

```xml
<mule xmlns:sqs="http://www.mulesoft.org/schema/mule/sqs" xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core"
	xmlns:file="http://www.mulesoft.org/schema/mule/file"
	xmlns:http="http://www.mulesoft.org/schema/mule/http"
	xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd
http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
  http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
  http://www.mulesoft.org/schema/mule/ee/core
  http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd
  http://www.mulesoft.org/schema/mule/file
  http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd
  http://www.mulesoft.org/schema/mule/sqs
	http://www.mulesoft.org/schema/mule/sqs/current/mule-sqs.xsd">
	<http:listener-config name="HTTP_Listener_config" doc:name="HTTP Listener config" >
		<http:listener-connection host="0.0.0.0" port="8081" />
	</http:listener-config>

	<sqs:config name="Amazon_SQS_Configuration" doc:name="Amazon SQS Configuration"
	defaultQueueUrl="${sqs.queueUrl}" >
		<sqs:basic-connection accessKey="${sqs.accessKey}" secretKey="$sqs.secretKey}" region="us-east-1" />
	</sqs:config>

	<sqs:config name="Amazon_SQS_Large_Payload_Configuration" doc:name="Amazon SQS Configuration"
	defaultQueueUrl="${sqs.queueUrl}" >
		<sqs:basic-connection accessKey="${sqs.accessKey}" secretKey="$sqs.secretKey}" region="us-east-1" >
			<sqs:large-payload-support bucket="large-sqs-payload-bucket" messageSizeThreshold="256" messageSizeThresholdUnit="KB" />
		</sqs:basic-connection>
	</sqs:config>

	<file:config name="File_Config" doc:name="File Config" >
		<file:connection workingDir="${app.home}" />
	</file:config>

	<flow name="sqs-send-LargeMessageFlow" >
		<http:listener doc:name="Listener"
		config-ref="HTTP_Listener_config"
		path="/largePayload"/>
		<file:read doc:name="Read" config-ref="File_Config" path="largePayload.txt"/>
		<ee:transform doc:name="Transform Message" >
			<ee:message >
				<ee:set-payload ><![CDATA[%dw 2.0
output application/java
---
{
	delaySeconds: 0,
	body: payload,
	messageAttributes: {
		"AccountId": {
			"stringValue" : "000123456",
			"dataType" : "String.AccountId"
		} as Object {
			class: "org.mule.extension.sqs.api.model.MessageAttributeValue"
		},
		"NumberId": {
			"stringValue" : "230.000000000000000001",
			"dataType" : "Number"
		} as Object {
			class : "org.mule.extension.sqs.api.model.MessageAttributeValue"
		}
	} as Object {
		class: "java.util.HashMap"
	}
} as Object {
	class: "org.mule.extension.sqs.api.model.Message"
}]]></ee:set-payload>
			</ee:message>
		</ee:transform>
		<sqs:send-message doc:name="Send message" configref="Amazon_SQS_Large_Payload_Configuration" config-ref="Amazon_SQS_Large_Payload_Configuration"/>
		<logger level="INFO"
		doc:name="Log Response"
		message="payload"/>
		<sqs:get-approximate-number-of-messages
		doc:name="Get approximate number of messages"
		config-ref="Amazon_SQS_Large_Payload_Configuration"
		queueUrl="${sqs.queueUrl}"/>
		<logger level="INFO" doc:name="Log Count"
		message="Sent Message: `#[payload]`"/>
	</flow>
	<flow name="sqs-receive-large-message-flow" >
		<sqs:receivemessages doc:name="Receive messages"
		config-ref="Amazon_SQS_Large_Payload_Configuration"/>
		<logger level="INFO" doc:name="Log Receipt" />
	</flow>
</mule>
```

## See Also

- [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors)

- [Salesforce Help](https://help.salesforce.com)
