What is Multicasting?
Multicasting is a communication process that takes place in a network environment. Essentially, a multicast is a message that originates with a single user and is received by multiple end points around the network.
In this blog post I am going to show WCF Routing Service Multicasting. Here a WCF Client sends a message to routing service that will Route the same message to one or more WCF Services which is hosted in different bindings and Addresses .For the demo purpose I am going to create Two WCF services( namely one ,two) and self hosting as windows Console application.
When we creating Multicast Service the WCF Operation Contract should be defined as One-way. Here is the definition of WCF Service contract which I am going to use here.
WCF Service Contract:
Here are the WCF services ,Routing Service and their endpoints definitions.
WCF Service Implementation:
This WCF service listen on port 6001 and binding netTcpBidning.
WCF Service Configuration definitions:
Create Second WCF service and implementation the same service contract with port 6002 and binding as wsHttpBinding.
Now we need to create WCF Routing Service and define the configuration.
Routing Service & Configuration:
Here I am using the “ISimplexDatagramRouter” as the contract’s interface and it is a simple message router, with a datagram, one-way, semantics and no session support (you can use “ISimplexSessionRouter” for session support, and use “IRequestReplyRouter” for a request/replay routing scenario).
By default this Routing Service routes the message to all the destination services is recognizes via the routing configuration (see below). This is done because I am using the “MatchAll message filter. Here is the list of message filters that come OOTB with WCF.
To test First Start WCF service 1 & 2 then Routing service finally run the client.
The Routing service also has the options to define and use a Failover or backup service. In the case of failure to deliver the message to any of the destination service endpoints. In the next blog we will see how to configure failover options.