Symfony Messenger with SQS and SNS AWS-Services

Stefan Pöltl
7 min readJun 10, 2020

Let’s checkout how to connect Symfony with Amazon SQS and SNS Services by using a Symfony component.

Github repo for this article:

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

We are going to use a Command-Bus pattern that seperates 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.

Setup the Symfony project:

Create a Symfony CLI skeleton:

docker run — rm -it -v $PWD:/app composer create-project symfony/skeleton symfony_messenger

Install Symfony Messenger component:

docker run --rm -it -v $PWD:/app composer…

--

--