Skip to content
This repository has been archived by the owner on May 10, 2022. It is now read-only.

[DEPRECATED] Installs and confgures SNS with Symfony Messenger

Notifications You must be signed in to change notification settings

brefphp/symfony-messenger-sns

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Symfony Messenger SNS pack

This small package helps you install and configure Symfony Messenger with SNS. If installed with Flex you will have most things configured for you.

Package contents

bin/message-consumer

This file will be "composer copied" to your projects bin folder (ie vendor/bin/message-consumer). This file receives SNS messages and gives them to App\Consumer\SnsConsumer.

src/Consumer.php

This class is responsible to decode the SNS message and put it back on the message bus. It dispatches events which one can subscribe to in order to modify behavior. Ie, retry failed events.

config/sns-consumer.yaml

This file will be copied by Flex to config/packages/sns-consumer.yaml. It contains example configuration for Messenger and Enqueue Bundle.

Bref template

Here is a small snippet to make sure we configure a consumer for SNS with Bref.

Resources:
    Consumer:
        Type: AWS::Serverless::Function
        Properties:
            FunctionName: 'my-app-consumer'
            Handler: vendor/bin/message-consumer
            Timeout: 20 # in seconds
            MemorySize: 2048
            # ...
            Events:
                Sns:
                    Type: SNS
                    Properties:
                        Topic: arn:aws:sns:eu-central-1:xxxxxxx:my_sns_topic

Local Development

When working in production we are using SNS but in local development we may want to use something simpler, say RabbitMQ.

# .env

# Production
AWS_SNS_DSN=enqueue://acme?topic[name]=my_sns_topic

# Development
AWS_SNS_DSN=amqp://guest:guest@127.0.0.1:5672/%2f/fake_sns 

Then you can consume messages are you normally would with bin/console messenger:consume.

About

[DEPRECATED] Installs and confgures SNS with Symfony Messenger

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages