Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WCF - IDuplexSessionRouter VS IRequestReplyRouter

Tags:

.net

wcf

I'm having 70-513 exam soon. There is a question in the dump that i don't understand.

A WCF service implements a contract with one-way and request-reply operations. The service is exposed over a TCP transport. Client use a router to communicate with the service.

The answer said using IDuplexSessionRouter instead of IRequestReplyRouter. Can i know why cannot use IRequestReplyRouter??

like image 307
kevin Avatar asked Sep 18 '11 11:09

kevin


2 Answers

That question is covered in this msdn article: Building a router (look for "Routers and Transport Sessions" section there)

like image 109
Alex Shlega Avatar answered Nov 15 '22 08:11

Alex Shlega


The Routing Service uses contracts that define the shape of the channels used to receive and send messages, and therefore the shape of the input channel must match that of the output channel.

So if you perform routing to endpoints that use the request-reply channel shape, then you must use a compatible contract on the inbound endpoints, such as the IRequestReplyRouter.

This means that if your destination endpoints use contracts with multiple communication patterns (such as mixing one-way and two-way operations) you cannot create a single service endpoint that can receive and route messages to all of them. A workaround is to use a duplex contract at the Routing Service such as IDuplexSessionRouter.

References:

http://msdn.microsoft.com/en-us/magazine/cc546553.aspx

http://msdn.microsoft.com/en-us/library/ee517422.aspx

like image 21
Sergio Vicente Avatar answered Nov 15 '22 08:11

Sergio Vicente