views:

24

answers:

1

I'm trying to accomplish some form of redirection of messages in .NET Remoting. alt text

As you can see in the image I would like for the client to send a message to the provider (which is the only URI that the client has to know about), which will then redirect this to host1. Here's the tricky part; the provider will keep track of which host is alive (by exposing a register/unregister remoting-method to the hosts), in other words the provider has to be able to dynamically change which URI it should redirect the message to.

I have been attempting to solve the problem by creating a host in the provider that the client sends messages to, and then a client (in the provider) that implements a custom proxy (by inheriting from RealProxy) that will redirect messages to the currently preferred host. However, I keep coming back to the problem about dynamically changing URI and I get the feeling that I'm just missing some easy, but vital, part that will solve this problem without turning it into a big hairy monster.

Any tips/hints will be much appreciated!

A: 

For future reference, I'm taking another, simplified, approach on this. The provider will be removed and instead the client will try to access host1 directly. In case of a SocketException, which is what it will get when the host doesn't reply, then put it in quarantine for X minutes and try with the next host. If all hosts are down, re-throw the exception.

Andyredbeard