mko
mko

Reputation: 7325

What is an alternative in AWS for sending message from SNS to SQS FIFO?

I have this situation where I am using Amazon SNS + SQS in order to handle domain events.

Basically on domain event I publish a message to SNS and two SQS queues are subscribed to SNS. Since i noticed SQS supports FIFO, but SNS doesn't support FIFO, I am trying to find a resolution on how to simultaneously deliver message A to multiple SQS FIFO queues?

What I had so far

All I can think of now is

Not really an atomic process I was looking for...

Is there an alternative to this approach?

Upvotes: 0

Views: 1141

Answers (3)

Otavio Ferreira
Otavio Ferreira

Reputation: 964

Today, we launched Amazon SNS FIFO topics, which can fan out messages to multiple Amazon SQS FIFO queues!

https://aws.amazon.com/about-aws/whats-new/2020/10/amazon-sns-introduces-fifo-topics-with-strict-ordering-and-deduplication-of-messages/

Upvotes: 1

John Rotenstein
John Rotenstein

Reputation: 270154

If your goal is to have a message be pushed to two Amazon SQS FIFO queues, I'd recommend:

  • Have Amazon SNS trigger an AWS Lambda function
  • The Lambda function can send the same message to both Amazon SQS queues

It is effectively doing the fan-out via Lambda rather than SNS.

The Lambda function might also be able to extract a Message Group ID that it can provide with the SQS message, which will enable parallel processing of messages while maintaining FIFO within the message group. For example, all messages coming from a particular source will be FIFO, but can be processed in parallel with messages from other sources. It's a very powerful capability that would not be available just by having Amazon SNS forward the message.

Upvotes: 0

Łukasz Olszewski
Łukasz Olszewski

Reputation: 915

You can think about using the AWS Kinesis Data stream. One feature of it is an ordering.

From faq: https://aws.amazon.com/kinesis/data-streams/faqs/

When should I use Amazon Kinesis Data Streams, and when should I use Amazon SQS?

Ordering of records. For example, you want to transfer log data from the application host to the processing/archival host while maintaining the order of log statements.

You can process events from Kinesis to SQSs.

Upvotes: 0

Related Questions