真实世界使用JMS /消息队列? [英] Real world use of JMS/message queues?

查看:161
本文介绍了真实世界使用JMS /消息队列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚阅读有关JMS和Apache ActiveMQ的abit。
并且想知道现实世界有什么人在这里使用JMS或类似的消息队列技术?

I was just reading abit about JMS and Apache ActiveMQ. And was wondering what real world use have people here used JMS or similar message queue technologies for ?

推荐答案

JMS( ActiveMQ是一个JMS代理实现)可以用作允许异步请求处理的机制。您可能希望这样做,因为请求需要很长时间才能完成,或者因为多方可能对实际请求感兴趣。使用它的另一个原因是允许多个客户端(可能用不同语言编写)通过JMS访问信息。 ActiveMQ就是一个很好的例子,因为你可以使用STOMP协议来允许从C#/ Java / Ruby客户端进行访问。

JMS (ActiveMQ is a JMS broker implementation) can be used as a mechanism to allow asynchronous request processing. You may wish to do this because the request take a long time to complete or because several parties may be interested in the actual request. Another reason for using it is to allow multiple clients (potentially written in different languages) to access information via JMS. ActiveMQ is a good example here because you can use the STOMP protocol to allow access from a C#/Java/Ruby client.

一个真实世界的例子是Web应用程序的例子用于为特定客户下订单。作为下订单(并将其存储在数据库中)的一部分,您可能希望执行许多其他任务:

A real world example is that of a web application that is used to place an order for a particular customer. As part of placing that order (and storing it in a database) you may wish to carry a number of additional tasks:


  • 存储订单某种第三方后端系统(如SAP)

  • 向客户发送电子邮件通知他们已下订单

为此,您的应用程序代码会将消息发布到包含订单ID的JMS队列。监听队列的应用程序的一部分可以通过获取orderId,在数据库中查找订单然后将该订单与另一个第三方系统放在一起来响应事件。您的应用程序的另一部分可能负责获取orderId并向客户发送确认电子邮件。

To do this your application code would publish a message onto a JMS queue which includes an order id. One part of your application listening to the queue may respond to the event by taking the orderId, looking the order up in the database and then place that order with another third party system. Another part of your application may be responsible for taking the orderId and sending a confirmation email to the customer.

这篇关于真实世界使用JMS /消息队列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆