Need Asynchronous WCF solution which allows for multiple responses

J

jtbjurstrom

Bear with me because we are new to WCF and have been going through
documentation and samples trying to absorb as much as possible in a
short amount of time. Any suggestions would be much appreciated. We
would of course rather start off on the right path instead of learning
later that there's a much better and easier solution, but get stuck
with our original implementation.

We are working on designing a client server solution using WCF where
we will have at most 20 clients calling the server with a requests
using NetTcp. Because of the amount of data that can be returned and
usability we want to make this an asynchronous call as well as allow
the server return chunks of data at a time.

- It looks like the Duplex calls only allow for a single response from
the server, so this option is out.
- We have considered creating an Endpoint on both the server and the
client. When requesting data from the server the client would pass
it's Endpoint information to the server. The server would then create
a channel using the client Endpoint info and send responses to the
client in chunks.
- We have also considered using a pattern similar to reading data from
a file where the client will request chunks of data from the server in
multiple calls until it receives an EOF flag. This would need to be
asynchronous as well. This would keep us from creating an Endpoint on
each client. I'm not sure if this is a benefit, but it's one less
thing to do.
- Finally, what would be the best way to pass back the data. We've
created a simple data container, which looks like a basic dataset and
is decorated to allow serialization by WCF. It seems like it would be
sufficient.

Again, any suggestions to get us on the right path earlier rather than
later would be very much appreciated.

Jayson
 
W

Willy Denoyette [MVP]

Bear with me because we are new to WCF and have been going through
documentation and samples trying to absorb as much as possible in a
short amount of time. Any suggestions would be much appreciated. We
would of course rather start off on the right path instead of learning
later that there's a much better and easier solution, but get stuck
with our original implementation.

We are working on designing a client server solution using WCF where
we will have at most 20 clients calling the server with a requests
using NetTcp. Because of the amount of data that can be returned and
usability we want to make this an asynchronous call as well as allow
the server return chunks of data at a time.

- It looks like the Duplex calls only allow for a single response from
the server, so this option is out.
- We have considered creating an Endpoint on both the server and the
client. When requesting data from the server the client would pass
it's Endpoint information to the server. The server would then create
a channel using the client Endpoint info and send responses to the
client in chunks.
- We have also considered using a pattern similar to reading data from
a file where the client will request chunks of data from the server in
multiple calls until it receives an EOF flag. This would need to be
asynchronous as well. This would keep us from creating an Endpoint on
each client. I'm not sure if this is a benefit, but it's one less
thing to do.
- Finally, what would be the best way to pass back the data. We've
created a simple data container, which looks like a basic dataset and
is decorated to allow serialization by WCF. It seems like it would be
sufficient.

Again, any suggestions to get us on the right path earlier rather than
later would be very much appreciated.

Jayson


Please post WCF related questions to the WCF forum at :
http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=118&SiteID=1

Willy.
 
D

David Browne

Bear with me because we are new to WCF and have been going through
documentation and samples trying to absorb as much as possible in a
short amount of time. Any suggestions would be much appreciated. We
would of course rather start off on the right path instead of learning
later that there's a much better and easier solution, but get stuck
with our original implementation.

We are working on designing a client server solution using WCF where
we will have at most 20 clients calling the server with a requests
using NetTcp. Because of the amount of data that can be returned and
usability we want to make this an asynchronous call as well as allow
the server return chunks of data at a time.

How much data are you talking about? Have you tested using a simple duplex
contract using a binary formatter and tcp transport?

David
 
J

jtbjurstrom

How much data are you talking about? Have you tested using a simple duplex
contract using a binary formatter and tcp transport?

David

We are estimating that the larger responses could be around 75 mb. The
size is definitely an issue but the server accumulates the data in
chunks and it also can take while to gather all the data. So, getting
the data back in subsets is ideal.
 
J

Joerg Jooss

Thus wrote (e-mail address removed),
Bear with me because we are new to WCF and have been going through
documentation and samples trying to absorb as much as possible in a
short amount of time. Any suggestions would be much appreciated. We
would of course rather start off on the right path instead of learning
later that there's a much better and easier solution, but get stuck
with our original implementation.

We are working on designing a client server solution using WCF where
we will have at most 20 clients calling the server with a requests
using NetTcp. Because of the amount of data that can be returned and
usability we want to make this an asynchronous call as well as allow
the server return chunks of data at a time.

Asynchronous calls and asynchronous service execution are local phenomenon
and are not related to what happens on the wire or what metadata a service
exposes.

As far as chunking is concerned -- there are several implementations available
on the Web, but probably you want to use streaming instead, which is built-in.
- It looks like the Duplex calls only allow for a single response from
the server, so this option is out.

I'm not sure what you mean by "single message". A service can implement only
one Duplex contract, but you can host multiple Duplex bound services in a
single server application.
- We have considered creating an Endpoint on both the server and the
client. When requesting data from the server the client would pass
it's Endpoint information to the server. The server would then create
a channel using the client Endpoint info and send responses to the
client in chunks.

This gives you more flexibility regarding contract design, but you must implement
a full blown service host in your client application.
- We have also considered using a pattern similar to reading data from
a file where the client will request chunks of data from the server in
multiple calls until it receives an EOF flag.

That's ugly, as it exposes technical communication details in your service
contracts. That's what WCF actually tries to avoid.

[...]
- Finally, what would be the best way to pass back the data. We've
created a simple data container, which looks like a basic dataset and
is decorated to allow serialization by WCF. It seems like it would be
sufficient.

How did you allow serialization? In case of doubt, use a DataContract.

Cheers,
 
J

jtbjurstrom

Thus wrote (e-mail address removed),
Bear with me because we are new to WCF and have been going through
documentation and samples trying to absorb as much as possible in a
short amount of time. Any suggestions would be much appreciated. We
would of course rather start off on the right path instead of learning
later that there's a much better and easier solution, but get stuck
with our original implementation.
We are working on designing a client server solution using WCF where
we will have at most 20 clients calling the server with a requests
using NetTcp. Because of the amount of data that can be returned and
usability we want to make this an asynchronous call as well as allow
the server return chunks of data at a time.

Asynchronous calls and asynchronous service execution are local phenomenon
and are not related to what happens on the wire or what metadata a service
exposes.

As far as chunking is concerned -- there are several implementations available
on the Web, but probably you want to use streaming instead, which is built-in.
- It looks like the Duplex calls only allow for a single response from
the server, so this option is out.

I'm not sure what you mean by "single message". A service can implement only
one Duplex contract, but you can host multiple Duplex bound services in a
single server application.
- We have considered creating an Endpoint on both the server and the
client. When requesting data from the server the client would pass
it's Endpoint information to the server. The server would then create
a channel using the client Endpoint info and send responses to the
client in chunks.

This gives you more flexibility regarding contract design, but you must implement
a full blown service host in your client application.
- We have also considered using a pattern similar to reading data from
a file where the client will request chunks of data from the server in
multiple calls until it receives an EOF flag.

That's ugly, as it exposes technical communication details in your service
contracts. That's what WCF actually tries to avoid.

[...]
- Finally, what would be the best way to pass back the data. We've
created a simple data container, which looks like a basic dataset and
is decorated to allow serialization by WCF. It seems like it would be
sufficient.

How did you allow serialization? In case of doubt, use a DataContract.

Cheers,

Thanks. I'll have to look into streaming our return data. Are there
any examples or articles out there for this?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top