Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Streaming an undetermined number of objects through WCF

Tags:

c#

wcf

streaming

I have a WCF service that needs to read large (10 to 20 million) numbers of objects from the database.

What I'd like to do, is have the client open up a stream and have the server push data from the database as it's reading.

So the client could just sit in a loop deserializing messages until it gets the EOF message from the server, in the style of the Twitter Streaming API, but with a finite set. The issue I'm having, is how to return the stream and then keep writing to it. Is this possible with WCF?

like image 444
Jason Ruckman Avatar asked Aug 29 '10 12:08

Jason Ruckman


1 Answers

How about instead of setting up a streaming/blocking service you use something like WS Dual Http. With it you have an async bidirectional callback channel that allows you to request/reply information back and forth between the server and the client. Issues you may see if you want to stream the entire set is a normal fashion is that some of the resources may block other requests (or timeout) while other users try to access the service.

like image 57
Matthew Whited Avatar answered Nov 13 '22 20:11

Matthew Whited