开发者

messaging between clients without polling

开发者 https://www.devze.com 2023-02-16 18:50 出处:网络
I have a network of MS SQL servers connected to each other with (C++/C#)clients connected to them. and I\'m about designing a way of messaging between clients and server-client messaging.

I have a network of MS SQL servers connected to each other with (C++/C#)clients connected to them. and I'm about designing a way of messaging between clients and server-client messaging. I've alread read about MS SQL Service Broker and other Brokers like Apache Qpid. but still I cant find out how would this work, I would be thankful is someone could provide me with better sources or if someone has already worked with such an issue.

How could I make sending and recieving messages between clients without possible?

and please make sure this is no school homework or university course project.

I would really appreciate a开发者_StackOverflowny helpful comment or advice...

+++Thanks+++


MSDN has quite a bit of technical information regarding SQL Service Broker. It is fairly high-level, but if you dig / read enough you will be a pro in no time.

http://msdn.microsoft.com/en-us/library/ms166043%28SQL.90%29.aspx

There are also a bunch of useful code samples floating around on the internet that should get you up and running so you can start experimenting.

http://blogs.msdn.com/b/sql_service_broker/
http://www.mssqltips.com/tip.asp?tip=1836

Best of Luck!


Why not poll? It's easy, the "dumbest thing that could possibly work".

I suggest you consider polling unless you have established what the problem with polling is.

Considerations:

  1. Timeliness. How quickly must the message be recieved?
  2. Frequency. How many messages are sent to each client per hour? Per day?

Plus, if your application has a connection heartbeat anyway, you could have it report whether there are any new messages and kill two birds with one stone.


If you are affraid of doing a

//PSUDO Code
while(!stopped){
   try{
     message = receiver.fetch(timeout);
   }catch(TimeoutException){
     //handle
   }

}

You could always prefetch, set the prefetch:

  receiver.setCapacity(100);

and then you could use the available messages functionality, but in all reality, this sounds like polling, in a backwards way ;)

0

精彩评论

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

关注公众号