If Service1 wants to send a command asynchronously towards a service2, which would be ideal:
service1 -> sns -> sqs -> service2
or
service1 -> sqs -> service2
What would be the basis on deciding on this?
If Service1 wants to send a command asynchronously towards a service2, which would be ideal:
service1 -> sns -> sqs -> service2
or
service1 -> sqs -> service2
What would be the basis on deciding on this?
If you want your command to be received by only one consumer use SQS.
If you want it to be received by many consumers publish your command to SNS and subscribe with SQS. Many different subscription types are available in addition to SQS e.g. Lambda, Email, Webhook etc.
In both cases commands (or messages) will be delivered asynchronously.
If you want only a single consumer and also ordered delivery you can use FIFO SQS queues. Ordered delivery cannot be achieved with SNS + SQS.
Amazon SQS will not "deliver" a message. Rather, the application needs to poll SQS to request a message.
Thus, if you wish to "push" a message to your application, then Amazon SNS is more appropriate, but it will not queue messages.
Some people prefer to implement the first option since other consumers can be added with no change to existing code or configuration. The new consumers would simply subscribe to the existing Amazon SNS topic.
However, if you know for sure that there will never be another consumer, then you could feel comfortable going direct to an Amazon SQS queue.