In this blog post I am going to show how to configure WCF 4.0 Routing Service Failover option. I wanted to make sure not to confuse Failover Vs Load balancing. Service Failover means when client can not reach or communicate with the Service the fall back route is called Failover. for example let say we have hosted a WCF order Service as main Service, when client wanted to place an order it calls PlaceOrder Operation service once service receives the message it will process it.
suppose let say when client calls Operation (Method) on order service at that time if service not available in this case the PlaceOrder Operation message dropped between server and client instead of losing a message we will persist in MSMQ once service comes online we can push these order again to the service to process.
In Windows environment Microsoft Messaging Queue (MSMQ) Service mainly used for to build fault tolerance applications. MSMQ provides Public (as a Active Directory ) and Private Queues to persist the messages when client fails to communicate with service. Here we are going to use MSMQ Private Queue as a our backup service.
Now we need to create and host the following Service components.
- Define Service Contract and Implementation.
- WCF Order Service (Main service)
- Backup or Fail over Service
- Routing Service
- Client App
1) Service & Operation Contracts Definition:
2) Order Service Hosting (Main Service)
Configuration
3) Backup or Failover Service Hosting
4) Routing Service Hosting
Client Application
Create Windows console application and add Service Reference ( Order Service) .
Now we need to modify the Endpoints which points to Router service instead of pointing to WCF Order Service.
Before Modification
After Modification
when main service is not running then Router service will send message to MSMQ .
Nandri(Thanks)
SreenivasaRagavan
1 comment:
Hey, this is a great example of how to create a routing service which could be used for many different purposes. However, if the routing service becomes unavailable, what do you do? I would assume that the routing service is stateless, so you could have multiple instances running in a farm and then use an NLB to distribute requests, but this seems a bit overkill. How do you ensure that the router stays available?
Thanks, Chris
Post a Comment