InquisitiveMind
asked on
Ping (IsAlive) between two WCF windows Services
Hi Experts,
I am looking to communicate between two Services (rather two instances of the same service) on two different servers. InstanceB should periodically check if InstanceA is alive.
These services are producing services and not consuming services. Both instances would be running at the same time, but only InstanceA would be producing the needed values. Only if InstanceA fails, would InstanceB takeover.
I'm thinking of taking the 'IsAlive' approach where InstanceB checks if InstanceA is alive every 10 seconds. I've added an IsAlive() method to my contract. Since both the Instances would be Identical, how would my code to call the IsAlive() method or config file have to change?
I would appreciate a code sample.
Thanks in advance!
I am looking to communicate between two Services (rather two instances of the same service) on two different servers. InstanceB should periodically check if InstanceA is alive.
These services are producing services and not consuming services. Both instances would be running at the same time, but only InstanceA would be producing the needed values. Only if InstanceA fails, would InstanceB takeover.
I'm thinking of taking the 'IsAlive' approach where InstanceB checks if InstanceA is alive every 10 seconds. I've added an IsAlive() method to my contract. Since both the Instances would be Identical, how would my code to call the IsAlive() method or config file have to change?
I would appreciate a code sample.
Thanks in advance!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Is it like client will call InstanceB....and instaneB will check if instanceA is alive then it will ask InstanceA to perform and work instaed of InstanceB doing the same work ?
ASKER
@apeter:
InstanceA and InstanceB are both producing services(both auto start) and not consuming services (When I say producing services, they have a method called GenerateValues() which are generated every 15 seconds. )
Both of them are in a running state initially, but only InstanceA has the GenerateValues() method returning values to the client upon OnStart. InstanceB will not be returning the values. It should start generate values method only when a ping to InstanceA doesn't return a value. Is that any better?
InstanceA and InstanceB are both producing services(both auto start) and not consuming services (When I say producing services, they have a method called GenerateValues() which are generated every 15 seconds. )
Both of them are in a running state initially, but only InstanceA has the GenerateValues() method returning values to the client upon OnStart. InstanceB will not be returning the values. It should start generate values method only when a ping to InstanceA doesn't return a value. Is that any better?
then below might work ?
if (InstanceAProxy.IsAlive())
InstanceAProxy.GenerateVal ues()
else if (InstanceBProxy.IsAlive())
InstanceBProxy.GenerateVal ues()
else
//what happens
But why InstanceA is not always live ?
if (InstanceAProxy.IsAlive())
InstanceAProxy.GenerateVal
else if (InstanceBProxy.IsAlive())
InstanceBProxy.GenerateVal
else
//what happens
But why InstanceA is not always live ?
http://www.codeguru.com/csharp/.net/net_wcf/article.php/c19895/Introduction-to-Routing-Service-in-WCF-40.htm
and
http://stackoverflow.com/questions/3824881/design-pattern-for-wcf-client-switching-and-failover-capabilities
Thanks