您会使用发布/订阅或队列来进行长时间运行的后台进程吗?

发布于 2024-09-15 02:28:45 字数 254 浏览 3 评论 0原文

我有一个 Web 服务,它接收在 Oracle 数据库中执行一些数据传输操作的请求(此类传输操作大约需要 30 分钟到 2 小时)。我设计的 Web 服务是为了将 JMS 用于这些流程。一旦请求到达,消息就会发送到 ActiveMQ,有一个侦听器类接收这些消息,然后调用处理程序类来执行操作。现在我的问题是:我对 JMS 很陌生,并且我知道有一些方法可以处理消息传递:pub/sub 和队列,所以在这种情况下,pub/sub 是首选方法还是队列?各自的优点/缺点是什么?

谢谢!

I have a webservice which receives requests to perform some data transfer operations within an Oracle database (such transfer operation takes about 30mins to 2 hours). I designed the webservice to use JMS for these processes. Once a request arrives, a message is sent to ActiveMQ, there's a listener class that receives those and then calls a handler class to perform the operations. Now my question is: I'm quite new to JMS, and I know there are methods to approach messaging: pub/sub and queues, so in this case, is pub/sub the preferred approach or queues? What are the pros/cons of each?

Thanks!

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

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

发布评论

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

评论(1

绳情 2024-09-22 02:28:45

这相当简单:

  • 如果您希望多个收件人收到来自一个发件人的消息的通知,那么
  • 如果您需要点对点通信(即一个发件人和一个收件人) ,请使用主题(发布/订阅),使用队列

It's rather straightforward:

  • if you want multiple recipients to be notified for a message from one sender then use topics (pub/sub)
  • if you need point-to-point communication - i.e. one sender and one recipient, use queues
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文