[rabbitmq-discuss] .NET client with multiple hosts - connecting to one of the nodes in the cluster with failover

Emile Joubert emile at rabbitmq.com
Thu Oct 27 15:21:08 BST 2011


Hi,

On 26/10/11 23:47, TrueWill wrote:
> We know in advance what hosts are in our cluster (say, HostA and HostB).
> Initially our client has to try to connect to one of them (HostA, for
> instance). We'd like it to try HostA and, if that doesn't work, HostB
> (then throw an exception on failure).
> 
> RabbitMQ.Client.ConnectionFactory.CreateConnection has a protected
> overload that accepts an array of AmqpTcpEndpoint objects. Is this
> exposed anywhere? Are we supposed to descend from the standard factory?

The .net library supports multiple protocols, including AMQP 0-8.
Brokers supporting 0.8 have the ability to redirect connections and for
clients to attempt connections to a list of brokers. Much of this
support was dropped from the .net client when the broker reached 0-9-1,
in particular, it is only possible to specify a single target broker.

> Or is there a better way? We can certainly solve this by catching
> BrokerUnreachableException and trying the next one, but this seems like
> a problem that others must have solved.

Rabbit client libraries leave room for improvement in this regard,
especially with the introduction of high availability
(http://www.rabbitmq.com/ha.html) on the broker. The approach you
suggest sounds like a reasonable one to take at present.




-Emile


More information about the rabbitmq-discuss mailing list