akka-rabbitmq icon indicating copy to clipboard operation
akka-rabbitmq copied to clipboard

Specifying node's address for Rabbitmq cluster

Open navidhsz opened this issue 5 years ago • 2 comments

In cluster environment usually it is possible to specify node's address in factory.newConnection(List<Address> addrs) method. Is it possible to do the same in Newmotion.

navidhsz avatar Aug 31 '18 15:08 navidhsz

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 avatar Dec 01 '18 11:12 sbmpost

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.

sbmpost avatar Dec 01 '18 12:12 sbmpost