0

I added new RabbitMQ Server & configured my Publisher connections string to with

"host=PC1:5672,PC2:5672"

var bus = RabbitHutch.CreateBus(connectionString, x => x.Register<IClusterHostSelectionStrategy<ConnectionFactoryInfo>, RandomClusterHostSelectionStrategy<ConnectionFactoryInfo>>());

When i publish I`m using bus.Publish(msg)

When i publish messages , the messsages are sending to PC 1 only. How can i make sure that messages will send to both, randomly.

Abhishek Gurjar
  • 7,426
  • 10
  • 37
  • 45
liormk1
  • 3
  • 2

1 Answers1

0

The instance only creates 1 connection when you instantiate it, but picks that host randomly.

If you really want to send to random hosts you could create 2 bus instances connecting to the 2 different hosts, and pick one of those randomly yourself before you publish.

Wiebe Tijsma
  • 10,173
  • 5
  • 52
  • 68