Search code examples
symfonyconfigurationrabbitmqbundle

rabbitmq-bundle - symfony3 - how to configure a topic exchange and queues?


I can't find a great configuration for old sound rabbitmq bundle to deal with topics and wildcard.

All I want is a unique exchange that post to multiple queue using wildcard.

Let says for example, i have my exchange name user.update, and i want to post the same message on user.update.address, user.update.profile for a microservice strategy.

do you know how to configure in the configuration file ?

Thx for reading.


Solution

  • Just because you are looking for

    ... great configuration for old sound rabbitmq bundle ...

    visit http://www.inanzzz.com/ and search for "rabbitmq" which will give you what you wish for.

    To address your question, you can use config below (I haven't tested it but it should be fine). However, you still need to write whole functionality/classes/consumers/producers etc. so follow this example: RabbitMQ topic example with symfony including 1 Producer & 1 Exchange & 2 Queue & N Worker & 2 Consumer

    old_sound_rabbit_mq:
        connections:
            default:
                host:     %rabbitmq.host%
                port:     %rabbitmq.port%
                user:     %rabbitmq.user%
                password: %rabbitmq.pswd%
                vhost:    /
                lazy:     true
        producers:
            user_update_producer:
                connection:       default
                exchange_options: { name: user.update, type: topic }
        consumers:
            user_update_consumer:
                connection:       default
                exchange_options: { name: user.update, type: topic }
                queue_options:
                    name: user_update_queue
                    routing_keys:
                        - 'user.update.address'
                        - 'user.update.profile'
                callback:         your_application.consumer.user_update_consumer
    

    It's flow: user.update (P) -> user.update (E) -> [user.update.address & user.update.profile] -> user_update_queue (Q)