In this section we will look at the WCF Routing Service.
What is it?
The WCF Routing Service is an extension to WCF which allows you to create a component which implements message routing capabilities. The WCF Routing Service is very simple and is usually implemented with a web.config file which defines some WCF endpoints which the routing service will listen on. When a message is received the service will use the WCF Routing configuration in the web.config file to compare the message against rules to workout which WCF endpoint to forward the message on to.
The routing rules can be based on a number of types of thing such as comparing the SOAP action of the message or comparing an XPath on the message body.
A message router is one of the recognised Enterprise Integration Patterns and the role of a router in an integration architecture is relatively common. The WCF Routing Service is one of the easiest ways you can implement the router pattern for WCF services and the following picture shows what that could look like:
WCF Routing Service has the following features:
- Content Based Routing
- Protocol Bridging
- Backup endpoints
The strengths of WCF Routing Service are that its free and simple to use. Be cautious though that the routing rules can potentially get complex.
The main weakness of the WCF Routing Service is that it is a framework level product and while its cheap and easy to get up and running, it does not have the enterprise level features that many customers would want. You can extend your implementation of the WCF Routing Service by adding your own custom developed behaviours into the WCF pipeline.
The WCF Routing Service can be very effective when used but you need to be aware that you might trade off some monitoring and management capabilities which you could get with other products in exchange for this low cost and simple option.
The only dependency for WCF Routing Service is the WCF framework within .net.
WCF Routing Service can be hosted in your own application or in IIS or IIS with AppFabric. It can be hosted anywhere you would normally host WCF Services.
WCF Routing Service is free.
The following technologies are similar or have a relationship with WCF Routing Service:
WCF Routing Service is an implementation of a special service which extends WCF to provide a message router.
- Azure Service Bus Relay
WCF Routing Service and Azure Service Bus Relay can be combined to create a great pattern for exposing on premise WCF services to the cloud. Refer to the samples for more info.
Sentinet offers some similar WCF based routing capabilities like what you get with WCF Routing Service. Sentinet is focused more on creating an Enterprise level service virtualization product which can route services and offers a lot of other added value features. WCF Routing Service is a much simpler product but it therefore has a lot less features. WCF Routing Service is a developer component where you would be configuring .net config files and have limited monitoring capabilities. Sentinet gives you a rich service administration module. WCF Routing Service is a great way to implement your first routing components for simple scenarios but if you find that your implementation is growing and getting more complex then you should consider moving to Sentinet as it will give you a more mature product to help you manage your routing requirements plus other stuff.
Sample Usage Scenarios
The following sample scenarios show how you might use the WCF Routing Service:
The following links are some recommended reading on this technology:
- WCF Routing Service DeepDive – Filters – Richard Seroter – Click Here
- WCF 4.0 Routing Service Multicast Sample – Danny Cohen – Click Here