Simple pub/sub

Simple pub/sub

For the sake of avoiding duplication in the lab, steps such as initializing the SQS, SNS or EventGeneratorConfigurationUrl interfaces will be summarized. In addition, we will perform SQS in the lab in the style of Standard

In this lab, you will start by building a simple pub/sub implementation. An Amazon SNS topic will be used to publish events you an Amazon SQS queue subscriber. This will allow you to easily verify the successful delivery of your messages.

An Amazon SNS topic is a logical access point that acts as a communication channel. A topic lets you group multiple endpoints (such as AWS Lambda, Amazon SQS, HTTP/S, or an email address).

To broadcast the messages of a message-producer system (for example, an e-commerce website) working with multiple other services that require its messages (for example, checkout and fulfilment systems), you can create a topic for your producer system.

SQS

  1. Open AWS Management Console

    • Find SQS
    • Select SQS
    • In the SQS interface, select Create queue

SQS

If you have not created an Amazon SQS queue before, you will see the Simple Queue Service homepage. Select Get Started Now, otherwise click Create queue at the top of your queue list

  1. In the Create queue interface

    • Name, enter OrdersQueue

SQS

  1. Select Create queue

SQS

  1. From Queue Actions, select Subscribe Queue to SNS Topic

SQS

To receive published notifications for a topic, you must subscribe to an endpoint for that topic. In this case, we will register the SQS queue you created in the previous step as the endpoint. When you subscribe to an endpoint for a topic, the endpoint starts receiving published messages for the associated topic.

  1. Select SNS Topic Orders.
  • Select Save

SQS

  1. Verify OrdersQueue SQS queue successfully registered

SQS

  1. Select and view details Access policy

SQS

  1. Start message push test with Event Generator

    • Select Orders topic from the Topics list.
    • Select PUBLISH EVENT

SQS

You will need to choose the correct Region.

  1. Access to SQS

    • Find OrdersQueue
    • In the Messages Available section, the value is 1

SQS

  1. Select Send and receive messages.

SQS

  1. In the detail screen

    • Select Poll for messages

SQS

  1. We will see the columns ID, Sent, Size, and Receive Count

SQS

  1. View message details.

SQS

  1. Then we will delete the message

SQS

  1. Delete message successfully.

SQS

The steps in the lab are quite long, so be careful to avoid mistakes. You can learn more about Pub/sub pattern