ShellRechargeSolutionsEU / akka-rabbitmq

RabbitMq client in Scala and Akka actors
Other
229 stars 65 forks source link

Specifying node's address for Rabbitmq cluster #47

Open navidhsz opened 6 years ago

navidhsz commented 6 years ago

In cluster environment usually it is possible to specify node's address in factory.newConnection(List

addrs) method. Is it possible to do the same in Newmotion.

sbmpost commented 6 years ago

You can do this:

val factory = new ConnectionFactory {
  setHost(connectionParams.hosts.head.getHost)
  setPort(connectionParams.hosts.head.getPort)
  setUsername(connectionParams.username)
  setPassword(connectionParams.password)
  setVirtualHost(connectionParams.virtualHost)
}

val connectionActor = system.actorOf(ConnectionActor.props(factory), "connection-actor")
sbmpost commented 6 years ago

Reading your question again, I see your question is about multiple hosts. Indeed there is currently no clean way to set these. A workaround would be to extend the ConnectionFactory class and to override the newConnection() method.