Fanout

Fanout (the number of inputs that can be connected to a specified output). This way, a single published message can be copied on to multiple destinations, such as SQS queues; these kinds of designs promote decoupling and combine two messaging patterns, one-to-many communications, and durable reliable message delivery, as shown in the following diagram:

In this case, the payments-topic publishes the payment information of every SQS queue subscribed.

  1. To achieve this, we will create an SNS topic called payments-topic. Navigate to the SNS service, choose Topics | Create new topic:

  1. We need to specify a topic name, and to be able to subscribe, the ARN will be needed:

  1. Now update our PaymentsQueue by subscribing it to the SNS topic, as follows:

  1. In the subscription window, we have the option to choose from which topic our queue will be listening to. Choose the payments-topic, as shown in the following screenshot:

  1. Now it's time to send a message from the topic, so let's go back to the SNS console, choose the payments-topic, and Publish to topic:

The fanout pattern is a sophisticated way to achieve low latency reliable communications with the lowest effort. SNS will keep trying until it succeeds to deliver the messages to the SQS queue and HTTPS messages can be retried with retry policies and back-off functions until the subscriber receives the message.

Functionality such as webhooks can be achieved with SNS and mobile push capabilities to create real-time applications, chats, marketing campaigns, and IoT.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.211.239