什么是Java消息服务(JMS)? [英] What is Java Message Service (JMS) for?

查看:165
本文介绍了什么是Java消息服务(JMS)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在评估JMS,但我没有得到我可以用它的东西。

I am currently evaluating JMS and I don't get what I could use it for.

目前,我相信这将是一个Usecase:我想创建一个SalesInvoice PDF并在SalesOrder离开仓库时打印它,所以在交付交易期间我可以发送一个事务性打印请求,它刚刚在SalesOrder事务成功完成时开始。

Currently, I believe this would be a Usecase: I want to create a SalesInvoice PDF and print it when an SalesOrder leaves the Warehouse, so during the Delivery transaction I could send a transactional print request which just begins when the SalesOrder transaction completes successfully.

现在我发现大多数JMS产品都是独立服务器。

Now I found out most JMS products are standalone server.


  • 为什么需要独立服务器进行消息处理,例如使用Quartz调度程序进行一些简单的inproc处理?

  • 它如何与我的应用程序交互?

  • 是不是太慢了?

  • 您已成功实施的用例是什么?

  • Why would a need a Standalone Server for Message Processing, vs. e.g. some simple inproc processing with Quartz scheduler?
  • How does it interact with my application?
  • Isn't it much too slow?
  • What are Usecases you already implemented successfully?

推荐答案

JMS是一个非常有用的系统,但不是用于各种目的。

JMS is an amazingly useful system, but not for every purpose.

它本质上是一个在节点之间发送消息的高级框架,具有发现选项,健壮性,

It's essentially a high-level framework for sending messages between nodes, with options for discovery, robustness, etc.

一个有用的用例是当你希望一个客户端和一个服务器相互通信,但没有客户端实际拥有服务器的地址时(例如,你可以有多个服务器)。客户端只需要知道代理和队列/主题名称,服务器也可以连接。

One useful use case is when you want a client and a server to talk to one another, but without the client actually having the server's address (E.g., you may have more than one server). The client only needs to know the broker and the queue/topic name, and the server can connect as well.

JMS还增加了健壮性。例如,您可以对其进行配置,以便在客户端发送消息时服务器死亡或反之,您仍然可以从客户端发送消息或从服务器轮询消息。如果您曾尝试使用套接字直接实现它 - 这是一场噩梦。

JMS also adds robustness. For instance, you can configure it so that if the server dies while the client sends messages or the other way around, you can still send messages from the client or poll messages from the server. If you ever tried implementing this directly with sockets - it's a nightmare.

您描述的场景听起来像是一个经典的J2EE问题,您为什么不使用J2EE框架? JMS经常在J2EE内部用于通信,但是你获得了所有其他好处。

The scenario you describe sounds like a classic J2EE problem, why are you not using a J2EE framework? JMS is often used inside J2EE for communications, but you got all the other benefits.

这篇关于什么是Java消息服务(JMS)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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