Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

read from one RabbitMQ and publish to another #170

Open
accu-knauthg opened this issue May 15, 2019 · 2 comments
Open

read from one RabbitMQ and publish to another #170

accu-knauthg opened this issue May 15, 2019 · 2 comments

Comments

@accu-knauthg
Copy link

I have to read from a RabbitMQ in Canada and publish to an internal RabbitMQ here in the US. I have all the credentials, I'm just trying to figure out what the code would look like, since typical application.conf setups only have one RabbitMQ. I have to connect to / read from the one in Canada using SSL.

@urcadox
Copy link

urcadox commented Jun 12, 2019

Hello,

You can do this:

val firstRabbit = actorSystem.actorOf(Props(
  new RabbitControl(ConnectionParams.fromConfig(
    conf.getConfig("op-rabbit.first")
  )
))
val secondRabbit = actorSystem.actorOf(Props(
  new RabbitControl(ConnectionParams.fromConfig(
    conf.getConfig("op-rabbit.second")
  )
))

The config looks like this:

op-rabbit {
  topic-exchange-name = ${RABBITMQ_EXCHANGE}
  first {
    hosts = [${RABBITMQ_FIRST_HOST}]
    username = ${RABBITMQ_FIRST_USER}
    password = ${RABBITMQ_FIRST_PASSWORD}
    connection-timeout = 3s
    virtual-host = "/"
    port = ${RABBITMQ_FIRST_PORT}
    ssl = true
  }

  second {
    hosts = [${RABBITMQ_SECOND_HOST}]
    username = ${RABBITMQ_SECOND_USER}
    password = ${RABBITMQ_SECOND_PASSWORD}
    connection-timeout = 3s
    virtual-host = "/"
    port = ${RABBITMQ_SECOND_PORT}
    ssl = true
  }
}

@accu-knauthg
Copy link
Author

@urcadox : Thank you, I'll try that!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants