How to define a batching routing service in WCF

Posted by mattx on Stack Overflow See other posts from Stack Overflow or by mattx
Published on 2010-05-19T20:08:31Z Indexed on 2010/05/19 20:10 UTC
Read the original article Hit count: 246

Filed under:

I have designed a custom silverlight wcf channel that I want to leverage to selectively batch calls from the client to the server and possibly to cache on the client and short circuit calls.

So far I'm just using this channel as a transport and sending the generic WCF messages that result to the WCF router service example here http://msdn.microsoft.com/en-us/magazine/cc500646.aspx?pr=blog to prototype this on the server side.

So my scenario looks like this:

IFooClient->MyTransportChannel->IRouterService->IFooService->Return

I now need to be able to send more than one message per call through the router and carve them up and service them on the server side. Since this is just an experiment and I'm taking baby steps I will dispatch and service all the messages right away on the server side and return the batch of results.

Immediately I noticed that simply making the router interface take Message[] instead of Message doesn't work due to serialization problems. I guess this makes sense. I'm not sure soap envelopes can contain other soap envelopes etc.

Is there a simple way to take a collection of WCF Message objects and send them to a single method on a service where they can be split up and forwarded as appropriate? If not I'd love suggestions on how I should approach this. I want to have minimal work to do on the router service side so the goal should be to get as close to being able to "slice and forward" as possible.

© Stack Overflow or respective owner

Related posts about wcf