开发者

4.0/WCF: Best approach for bi-idirectional message bus?

开发者 https://www.devze.com 2022-12-27 17:37 出处:网络
Just a technology update, now that .NET 4.0 is out. I write an application that communicates to the server through what is basically a message bus (instead of method calls). This is based on the inte

Just a technology update, now that .NET 4.0 is out.

I write an application that communicates to the server through what is basically a message bus (instead of method calls). This is based on the internal architecture of the application开发者_如何学运维 (which is multi threaded, passing the messages around).

There are a limited number of messages to go from the client to the server, quite a lot more from the server to the client. Most of those can be handled via a separate specialized mechanism, but at the end we talk of possibly 10-100 small messages per second going from the server to the client.

The client is supposed to operate under "internet conditions". THis means possibly home end users behind standard NAT devices (i.e. typical DSL routers) - a firewalled secure and thus "open" network can not be assumed.

I want to have as little latency and as little overhad for the communication as possible.

What is the technologally best way to handle the message bus callback? I Have no problem regularly calling to the server for message delivery if something needs to be sent... ...but what are my options to handle the messagtes from the server to the client?

  • WsDualHttp does work how? Especially under a NAT scenario?

Just as a note: polling is most likely out - the main problem here is that I would have a significant overhead OR a significant delay, both aren ot really wanted. Technically I would love some sort of streaming appraoch, where the server can write messags to a stream while he generates them and they get sent to the client as they come. Not esure this is doable with WCF, though (if not, I may acutally decide to handle the whole message part outside of WCF and just do control / login / setup / destruction via WCF).


For bidirectional communications, your best bet is NetTcpBinding, rather than the http bindings, if they're available.

This has the advantage of only requiring that the client can initiate a connection with the server.


I would go with Windows Azure Service Bus. See my answer in the following question:

WCF, 4.0, Bidirectional


Take a look at Windows AppFabric, good place to start is Here. It fundamentally wraps up WCF and WF into an application server, with WCF activation supported through WAS. Its where I would host this type of app. It offerd full duplex connection orientated, p2p or sessions between client and server. Don't confuse the Windows appfabric with Azure appfabric, (formely called Azure Service Bus).

As regards bindings above, both NetTcpBinding and WsDualHttp offer callbacks, but the ws binding you get a lot for your cash, especially if it's a mixed programming environment and you have to flatten the wsdl to make interop work. I also think that WsDual is easier on routers traversal, although I understand talking to friends, that Windows AppFabric mitigates this, with new Relay Services, (which i've not seen, and I think have now been renamed).

Hope that helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消