Skip to main content

AWS Simple Queue Service Listener

Listen for messages published on Amazon Simple Queue Service (AWS SQS) queues.

TagsQueueMessage BrokerSaas

Credential configuration

To configure this credential, you need to fill the credential configuration form with the AWS SQS connection parameters: accessKeyId and secretAccessKey.

Additionally to the connection information, you'll need to fill the following fields:

  • queueUrl: URL of the Amazon SQS queue from which messages are received.
  • visibilityTimeout (optional, default=10): duration (in seconds) that the received messages are hidden from subsequent retrieve requests. Aws docs.
  • waitTimeSeconds (optional, default=10): duration (in seconds) for which the call waits for a message to arrive in the queue before returning. If a message is available, the call returns sooner. Aws docs.
  • maxNumberOfMessages (optional, default=1): maximum number of messages to return. Amazon SQS never returns more messages than this value (however, fewer messages might be returned). Aws docs.
  • messageAttributeNames (optional): a list of names of the message attribute to receive. Aws docs.
  • messageSystemAttributeNames (optional): a list of attributes that need to be returned along with each message. Aws docs.

In the extra extended options field, you can include any of the parameters found here.

Here is an example of a filled credential configuration form in YepCode:

AWS SQS Listener snippets available in YepCode editor

note

The title is the triggering text for YepCode to autocomplete the script.

Listener

New listener
const listener = await yepcode.listener.awsSqs('yepcode-sqs-listener');
Start listener with callback message
const callback = (message) => console.log('New message received:', { message });

listener.start(callback);
Start listener with callback message and onCallbackError
const callback = (message) => console.log('New message received:', { message });

const onCallbackError = (error, message) =>
console.error(
"[Process] Error: '%s', processing message: %s",
error.message,
message
);

listener.start(callback, { onCallbackError });
Stop listener
listener.stop();