无需轮询即可在客户端之间发送消息

发布于 2024-10-23 13:37:53 字数 301 浏览 1 评论 0原文

我有一个相互连接的 MS SQL 服务器网络,并连接到它们的 (C++/C#) 客户端。我正在设计一种客户端之间的消息传递和服务器-客户端消息传递的方式。 我已经阅读过有关 MS SQL Service Broker 和其他 Broker(例如 Apache Qpid)的内容。 但我仍然不知道这是如何工作的,我会很感激有人可以为我提供更好的资源,或者是否有人已经解决过这样的问题。

我怎样才能使客户端之间无法发送和接收消息?

请确保这不是学校作业或大学课程项目。

我真的很感激任何有用的评论或建议...

+++谢谢+++

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 any helpful comment or advice...

+++Thanks+++

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

故人如初 2024-10-30 13:37:53

MSDN 有大量有关 SQL Service Broker 的技术信息。这是相当高水平的,但如果你挖掘/阅读足够多,你很快就会成为专业人士。

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

互联网上还有大量有用的代码示例,它们应该可以帮助您启动并运行,以便您可以开始试验。

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

祝你好运!

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!

手心的海 2024-10-30 13:37:53

为什么不民意调查?这很简单,是“可能有效的最愚蠢的事情”。

我建议您考虑轮询,除非您已经确定轮询的问题是什么。

考虑因素:

  1. 及时性。必须多快收到消息?
  2. 频率。每小时向每个客户端发送多少条消息?每天?

另外,如果您的应用程序无论如何都有连接心跳,您可以让它报告是否有任何新消息并一石二鸟。

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.

二智少女猫性小仙女 2024-10-30 13:37:53

如果您害怕执行“

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

}

您总是可以预取”,请设置预取:

  receiver.setCapacity(100);

然后您可以使用可用的消息功能,但实际上,这听起来像是反向轮询;)

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 ;)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文