JMS 和 ESB - 它们有何关系?
对我来说,JMS 和 ESB 似乎是非常相关的东西,我正在尝试了解它们到底是如何相关的。
我看到一句话说JMS可以用作ESB的传输——那么这样的ESB中除了传输之外还应该存在什么呢? JMS 是一个简单的 ESB,如果不是,那么它比真正的 ESB 缺少什么?
For me JMS and ESB seem to be very related things and I'm trying to understand how exactly they are related.
I've seen a sentence that JMS can be used as a transport for ESB - then what else except the transport should be present in such an ESB? Is JMS a simple ESB or if not, then what it lacks from the real ESB?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
JMS 提供了一组用于消息传递的 API:将消息放入队列中,稍后某个时间(也许地理位置较远)的其他人将消息从队列中取出并进行处理。我们把消息提供者和消费者在时间和地点上进行了解耦。即使消息使用者碰巧停机一段时间,我们也可以继续生成消息。
JMS 还提供发布/订阅功能,生产者将消息放入“主题”,任何感兴趣的各方都可以订阅该主题,在生成消息时接收消息,但目前仅关注队列功能。
我们已经解耦了提供者和消费者之间关系的某些方面。然而,一些耦合仍然存在。首先,就目前情况而言,每条消息都以相同的方式处理。假设我们想对不同类型的消息引入不同类型的处理:
显然我们可以编写这样的代码,但另一种选择是拥有一个消息系统,可以将不同的消息发送到不同的地方,我们设置三个队列:
然后所有我们需要队列系统本身的一点点聪明,才能将消息从请求队列传输到白金队列或标准队列。
因此,这是基于内容的路由功能,并且是 ESB 提供的功能。请注意,ESB 使用 JMS 提供的基本排队功能。
第二种耦合是消费者和生产者必须就消息格式达成一致。在简单的情况下就可以了。但是,当您开始让许多生产者都将消息放入同一个队列时,您就会开始遇到版本控制问题。引入了新的消息格式,但您不想更改所有现有的提供程序。
ESB 获取版本 1 队列消息并将其转换为版本 2 消息并将它们放入版本 2 队列中。
消息转换是另一种可能的 ESB 功能。
看一下 ESB 产品,看看它们能做什么。当我在 IBM 工作时,我最熟悉 WebSphere ESB
JMS offers a set of APIs for messaging: put a message on a queue, someone else, sometime later, perhaps geographically far away takes the message off the queue and processes it. We have decoupled in time and location of the message provider and consumer. Even if the message consumer happens to be down for a time we can keep producing messages.
JMS also offers a publish/subscribe capability where the producer puts the message to a "topic" and any interested parties can subscribe to that topic, receiving messages as and when they are produced, but for the moment focus just on the queue capabilty.
We have decoupled some aspects of the relationship between provider and consumer. However some coupling remains. First, as things stand every message is processed in the same way. Suppose we want to introduce different kinds of processing for different kinds of messages:
Obviously we can write code like that, but an alternative would be to have a messaging system that can send different messages to different places we set up three queues:
And then all we need is a little bit of cleverness in the queue system itself to transfer then messsage from the Request Queue to the Platinum Queue or Standard Queue.
So this is a Content-Based Routing capability, and is something that an ESB provides. Note that the ESB uses the fundamental Queueing capabilities offered by JMS.
A second kind of couppling is that the consumer and producer must agree about the message format. In simple cases that's fine. But when you start to have many producers all putting message to the same queue you start to hit versioning problems. New message formats are introduced but you don't want to change all the existing providers.
And the ESB picks up the Version 1 Queue messages and transforms them into Version 2 messages and puts them onto the Version 2 queue.
Message transformation is another possible ESB capability.
Have a look at ESB products, see what they can do. As I work for IBM, I'm most familiar with WebSphere ESB
我想说 ESB 就像许多协议的门面......JMS 就是其中之一。
I would say ESB is like a facade into a number of protocals....JMS being one of them.
JMS 不太适合 REST 服务、文件的集成系统、S/FTP、电子邮件、Hessian、SOAP 等,使用原生支持这些类型的 ESB 可以更好地处理这些类型。例如,如果您有一个进程在午夜转储 500MB 的 CSV 文件,并且您希望另一个系统拾取该文件、解析 CSV 并导入到数据库中,则这可以通过 ESB 轻松完成 - 而仅需要一个解决方案JMS 会很糟糕。同样,使用原生支持 HTTP/S 的 ESB 可以更好地集成 REST 服务以及到多个后端实例的负载平衡/故障转移。
JMS is not well suited for the integration of REST services, File systems, S/FTP, Email, Hessian, SOAP etc. which are better handled with an ESB that supports these types natively. For example, if you have a process that dumps a CSV file of 500MB at midnight, and you want another system to pickup the file, parse CSV and import into a database, this can easily be accomplished by an ESB - whereas a solution with just JMS will be bad. Similarly, integration of REST services, with load balancing/failover to multiple backend instances can be done better with an ESB supporting HTTP/S natively.
这种转变不会自动发生。您需要配置映射或编写转换服务
请参阅 https://access.redhat.com/knowledge/docs/en-US/JBoss_Enterprise_SOA_Platform/4.2/html/SOA_ESB_Message_Transformation_Guide/ch02s03.html
问候,
拉贾·纳根德拉·库马尔,
首席技术官
www.tejasoft.com
This Transformation does not happen automatically. You need to configure the mapping or write transformation service
Look at https://access.redhat.com/knowledge/docs/en-US/JBoss_Enterprise_SOA_Platform/4.2/html/SOA_ESB_Message_Transformation_Guide/ch02s03.html
Regards,
Raja Nagendra Kumar,
C.T.O
www.tejasoft.com
除了 JMS 之外,ESB 还提供与许多不同协议的集成。
大多数在幕后使用 JMS 来传输、存储和移动消息。 OpenESB 就是这样一种解决方案,它使用 XML 格式的消息。
您可以查看一些开源 ESB -
JMS 实现,例如 < a href="http://activemq.apache.org" rel="nofollow">ActiveMQ 内置了 Camel。
ESB offers integration with a lot of different protocols in addition to JMS.
Most use JMS behind the scenes to transfer, stor and move messages. One such solution OpenESB, uses XML format messages.
There are open source ESB which you could checkout -
JMS implementation like ActiveMQ come with Camel inbuilt into them.
JMS 是一种用于与底层消息传递层进行通信的协议。 ESB 在更高级别上运行,以统一的方式提供与多种技术和协议(其中之一是 JMS)的集成,使复杂流程的管理变得更加简单。
JMS is a protocol for communicating with an underlying messaging layer. ESB operates at a higher level, offering integration with multiple technologies and protocols, one of which would be JMS, in a uniform way that makes management of complex flows much simpler.
您可以使用 ESB 轻松配置 JMS 消息代理。 https://docs.wso2.com/display/ESB470/JMS+Transport
There are JMS message brokers , that you can easily configure with ESB. https://docs.wso2.com/display/ESB470/JMS+Transport
JMS 和 ESB 都提供了不同应用程序之间的通信方式。 但是 JMS 和 ESB 的上下文不同。 JMS是为了简单的需要。 JMS是由JMS Provider实现的。它是 Java 特有的。
JMS 提供程序的示例有:Apache Active MQ、IBM MQ、HornetQ 等。
ESB 是为了满足复杂的需求。 ESB 是 EAI 中的一个组件,为各种应用程序提供通信设施。 它是通用的&不特定于 Java。 JMS 是受支持的协议之一。
ESB 提供程序的示例有:MuleESB、Apache Camel、OpenESB
使用案例:如果我们所有的通信应用程序都采用 Java 语言并且使用相同的消息格式,那么使用 ESB 可能会产生开销。这里 JMS 可能就足够了。
JMS and ESB both provide a way of communication between different applications. But the context for JMS and ESB are different. JMS is for simple need. JMS is implemented by JMS Provider. It is Java specific.
Examples of JMS Providers are: Apache Active MQ, IBM MQ, HornetQ etc.
ESB is for complex need. ESB is a component in EAI providing communication facility to various applications. It is generic & not specific to Java. JMS is one of the supported protocols.
Examples of ESB provider are: MuleESB, Apache Camel, OpenESB
Use Case: It may be an overhead to use ESB, if all our communicating applications are in Java and are using the same message format. Here JMS may be sufficient.