Tuesday, April 13, 2010

WCF 4.0 Routing Service –Multicasting

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.

image

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:

image

      Here are the WCF services ,Routing Service and their endpoints definitions.

image

 

WCF Service Implementation:

image
    

          This WCF service listen on port 6001 and binding netTcpBidning.

WCF Service Configuration definitions:

    image

        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:

image

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).

 

image

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.

image

image

WCF Client:

  image

     To test   First Start WCF service 1 & 2 then Routing service  finally run the client.

image

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. 

Nandri(Thanks)

SreenivasaRagavan

3 comments:

TAN said...

where can we download your source code for testing?

TAN said...

where can I download your source code?

Pradeep Kumar said...

Hi i am getting this error :


Contract requires Session, but Binding 'BasicHttpBinding' doesn't support it or isn't configured properly to support it.