Company logo
  • Jobs
  • Bootcamp
  • About Us
  • For professionals
    • Home
    • Jobs
    • Courses
    • Questions
    • Teachers
    • Bootcamp
  • For business
    • Home
    • Our process
    • Plans
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Calculator

0

60
Views
Is it possible 1 application consume multiples exchanges?

What i have to do is consume 2 diferents queues in rabbitMQ, each one in a diferent vhost and diferent exchange.

Do i have to create 2 connections? is it possíble?

My .env is something like this:

CONSUMER_DIRECT_HOST=localhost
CONSUMER_DIRECT_VHOST=pd_logs
CONSUMER_DIRECT_LOGIN=guest
CONSUMER_DIRECT_PASSWORD=guest
CONSUMER_DIRECT_PORT=5672
CONSUMER_DIRECT_TYPE=direct
CONSUMER_DIRECT_QUEUE=queue-notification
CONSUMER_DIRECT_EXCHANGE=direct-notification
CONSUMER_DIRECT_ROUTING_KEY=callback
CONSUMER_PAYMENTS_HOST=localhost
CONSUMER_PAYMENTS_VHOST=/
CONSUMER_PAYMENTS_LOGIN=guest
CONSUMER_PAYMENTS_PASSWORD=guest
CONSUMER_PAYMENTS_PORT=5672
CONSUMER_PAYMENTS_TYPE=direct
CONSUMER_PAYMENTS_QUEUE=queue-payment-notification
CONSUMER_PAYMENTS_EXCHANGE=x-payment-events
CONSUMER_PAYMENTS_ROUTING_KEY=callback

I think i must have 2 applications, one for each vhost. I was thinking to have the same applications, just with diferent environment configuration.

Is not what i want, but i dont know how to do, is it possible?

I tried to create 2 connections at the same time, but it didnt work, or i implemented it wrong.

7 months ago · Juan Pablo Isaza
Answer question
Find remote jobs