Interact with a queue

Amazon Simple Queue Service (SQS) is a message queuing service for reliably communicating at any scale. SQS makes it simple and cost-effective to decouple and coordinate the components of a cloud application. Using SQS, you can send, store, and receive messages between software components at any volume, without losing messages or requiring other services to be always available. With DragToCode, you can seamlessly queue, dequeue, and delete messages with simple blocks.

Here's how we did it.

Amazon SQS Setup

We created a free trial account with Amazon AWS, then created a queue called "test."

The last step is to pick up the account ID, account key, and secret key.
You can get there in database settings, on a URL like[REGION]#/security_credential

You may want to keep the console open so we can watch the messages come across.

Script Setup

Now that we picked up the authenticators, we can enter it in a DragToCode connector.
A direct route is

Now we can add a message to the new queue with a single block:

Over on the Amazon Console, you can see the new message arrive:

Retrieving messages from a queue is a single block, but to grab only the message requires another block.

By retrieving it, now the message is "in flight" in the queue. Since queues are all about timing, you only have a few seconds to work (5 in this block) before the message is returned to the queue for another job to retrieve.

Why do we need the second block? Because the data that is returned includes not only the message text, but also the message identifier, used to change the status of the message later.

Job Scenarios

If you're done with a queue message and don't want another job to process it, you need to delete it from the queue. Use a delete block to do it:

If you need more time to work, you can get it by extending the timeout. The block to do that only needs the message object returned:

Sometimes a job just can't handle what is given, and needs to let it go back to the queue for reprocessing. Use a release block to do it:

In the Amazon Console, you can see the message immediately returns to an available state.

Sometimes you need to read the next item in the queue without actually taking it. For that, use the peek block:


With Amazon SQS, you can process vast numbers of messages without fear of loss, providing ironclad reliability. DragToCode can help you create and process those messages with ease. Give it a try and tell us about the great things you build!