Symfony messenger with SQS and SNS aws-services

Click for: original source

Let’ checkout how to connect Symfony with Amazon SQS and SNS Services by using a Symfony component. By Stefan Pöltl.

We are going to use a Command-Bus pattern that separates the description, what needs to be done, from where it’s going to happen. It’s like getting an order in a restaurant that gets prepared in the kitchen. In our case we will create a TestMessage object, that gets send and consumed by a handler.

What is the Symfony Messenger? It’s a Message-Bus that can be used for the following design patterns:

  • Command-Bus
  • Query-Bus
  • Event-Bus

The article then describes in great detail and provides code plus screen shots for:

  • Setup the Symfony project
  • Create a SQS queue in your AWS account
  • How to create the queue
  • Configure the Symfony project
  • Build a command to send data to the SQS queue
  • Debug Messages in SQS
  • Consume Queue Messages and send notifications with SNS

… and much more. The article also explains many concpets, i.e.what is SnsClient, what is SQS, message limitations etc. Good read!

[Read More]

Tags queues php distributed miscellaneous performance streaming