开发者

How to create custom WCF binding which effectively reverses the communication?

I have Server sending requests to Agents. When the agent has something to say it sends replies to Server. All is clear and simple.

Now, I wish to cancel the Server-to-Agent communication. In effect Agents will poll Server and get in reply if there is work to do.

It seems to me that all of this should be encapsulated in a custom WCF binding, which would contain the following items at least:

  • A reference to the effective WCF binding used to poll Server on the reversed Agent-开发者_StackOverflowto-Server channel.
  • Polling interval

From the Server perspective, the channel supports only one way interfaces. The server would use it as any one way interface - fire and forget. The custom binding would store the request details and supply them to the correct Agent as soon as it polls the Server.

I am not that experienced in writing custom WCF bindings. So, my question is to the experienced folks over there - does it make sense to implement the custom binding I am talking about? If so, I would really like to get some pointers.

Thanks.

EDIT1:

Agent is not a client of a server. The current logic is that Server initiates communication to the Agent, which makes it a client of Agent. The need to reverse the communication channel does not come from a functional change in their roles. Rather it is a result of firewall constraints on the Agent - it may ban any inbound communication. I wish to preserve the server side logic as much as possible, meaning the server continues to initiate the communication, but under the hood it is the agent which constantly polls for work.


I think you're looking for Pub/Sub Model here. Please check following link, it's an example, http://tomasz.janczuk.org/2009/07/pubsub-sample-using-http-polling-duplex.html

HTH Amit

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜