5
votes

I'm trying to figure out what is the best solution to work with rabbitmq cluster via wcf.

Current setup:

  1. 2 IIS web servers (act as message produces and post messages to queue via amqp wcf client).
  2. 2 servers with rabbitmq broker (clustered with mirrored queue, rabbit1 and rabbit2)
  3. Windows service ( worker) with hosted amqp wcf service that listens to incoming messages.

Web role posts messages to rabbit1 node and worker listens to rabbit1 node too. If rabbit1 node fails system(both web and worker) should switch to rabbit2. And that's the question, how to implement this in more elegant way rather than handling connection failures in application code.

First and the only approach I see now is to use wcf4 routing backup endpoints feature. This way solves problem on client side(web role) only but doesn't solve problem on wcf service side(worker role).

1

1 Answers

3
votes

One way is to create a wrapper around your service host, used for storing a list of connection strings (which can come from config).

Add a handler to the service faulted event, where you can close and reopen the host with a different connection string.