简体   繁体   English

何时使用Java和Message Broker?

[英]When to use Java and Message Broker?

I am a developer at my office where SOA development is at its peaks. 我是我办公室的开发人员,SOA开发处于巅峰状态。 We use IBM MQ, IBM Message Broker and Java/J2EE Technologies. 我们使用IBM MQ,IBM Message Broker和Java / J2EE Technologies。

I have been currently put into project where Message Broker is used to develop a middleware which interacts between two applications. 我目前已进入项目,其中使用Message Broker开发一个在两个应用程序之间进行交互的中间件。 I am not quite sure if Message Broker is the right option for such kind of a project since Java can do the same piece of work in a much efficient way, which led me to search Internet for advantages in using the two. 我不太确定Message Broker是否适合这种类型的项目,因为Java可以以一种非常有效的方式完成相同的工作,这使我在搜索Internet时获得了使用这两者的优势。

I read in different sites that Message Broker is used to transform,route and enhance messages, this can very well be done using java efficiently. 我在不同的站点中读到Message Broker用于转换,路由和增强消息,这可以通过有效地使用java来完成。 So this led me to this question "When to use Java and When to use Message Broker for development?" 所以这让我想到了这个问题“何时使用Java以及何时使用Message Broker进行开发?” It would be great if someone can help me with the advantages of using the two. 如果有人可以帮助我使用这两者的优势,那将是很棒的。

-RDJ -RDJ

Message brokers enable eg operations people to monitor all integrations in one place. 消息代理使例如操作人员能够在一个地方监视所有集成。 Also, if a data format changes it can be trivial to determine which integrations are affected by the change. 此外,如果数据格式发生变化,确定哪些集成受更改影响可能很简单。

Each individual integration could probably be implemented in Java (or any other language, for that matter), but you'd end up but with a bunch of point-to-point integrations, which is one of the problems message brokers try to solve. 每个单独的集成都可能用Java(或任何其他语言)来实现,但是你最终会有一堆点对点集成,这是消息代理试图解决的问题之一。

If you were to design a generalized transformation/routing solution in Java, you would be designing a message broker :) Which would be interesting, but not really necessary, seeing as plenty of commercial and open source message brokers are already available. 如果您要用Java设计一个通用的转换/路由解决方案,那么您将设计一个消息代理:)这将是有趣的,但并非真正必要,因为已经有大量的商业和开源消息代理可用。

As I understand you are trying to, for example, implement the functionality in core java instead of going with a ready Message Broker and similar SOA related technologies. 据我所知,您正在努力实现核心Java中的功能,而不是使用现成的Message Broker和类似的SOA相关技术。 My suggestion is - do not reinvent the wheel. 我的建议是 - 不要重新发明轮子。 The point is, even if you try to do so, eventually you will face the same technical issues and lead to a similar solution. 关键是,即使您尝试这样做,最终您将面临相同的技术问题并导致类似的解决方案。 Why not focus on business logic instead of trying to develop an equivalent of something which is already there which is probably more tested and trusted. 为什么不专注于业务逻辑而不是尝试开发已经存在的可能更加经过测试和信任的东西。

From a more practical standpoint, websphere message broker offers a way to integrate non-java applications (C, COBOL, PHP, VB ...) which is often difficult to accomplish with java. 从更实际的角度来看,websphere消息代理提供了一种集成非Java应用程序(C,COBOL,PHP,VB ...)的方法,这些应用程序通常很难用java实现。

Also, Java is not particularly well suited to process XML. 此外,Java并不特别适合处理XML。 Both ESQL and XSLT are much better vehicles for xml transformation that Java. ESQL和XSLT都是Java的xml转换的更好的工具。

Webshpere message broker is also able to deal with messaging outside the limitations of JMS (it can do JMS as well). Webshpere消息代理还能够处理JMS限制之外的消息传递(它也可以执行JMS)。

You might look at Websphere ESB which is kind of like a Java implementation of message broker. 您可以查看Websphere ESB,它有点像消息代理的Java实现。 This product expect external non-java applications to adapt themselves to the Java world, so it has less integration capability, but I think java people will find it comfortable to work with. 该产品期望外部非Java应用程序能够适应Java世界,因此它具有较少的集成能力,但我认为Java人们会觉得它很适合使用。

Messaging is usually used when you have Heterogeneous application integration and may be used as a replacement for RPC specially when it is Asynchronous. 当您具有异构应用程序集成时,通常会使用消息传递,并且可以在异步时将其用作RPC的替代。 It is also used to loosen the coupling between applications and as the backbone of an event-driven architecture. 它还用于放松应用程序之间的耦合,并作为事件驱动架构的主干。 Using message to improve application scalability is very common. 使用消息来提高应用程序的可伸缩性是很常见的。 In some cases it is used for the systems which are not always available but guarantee to fulfill the request when they become available. 在某些情况下,它用于并非总是可用的系统,但保证在可用时满足请求。 Also it is used for systems which have more than one consumer per request. 它也用于每个请求有多个消费者的系统。

Websphere Message Broker is an ESB whereas Java on the other hand is a programming language . Websphere Message Broker是一个ESB,而另一方面,Java是一种编程语言。 There are ESBs which use Java as their implementation language like Axis , Fuse but are they powerful enough to parse XMLs , orchestrate services , integrate with mainframe systems .Webservice design and development in Message Broker is easy and user -friendly .ESQL as correctly pointed out is powerful for XML transformation and processing is the implementaion language used in Message Broker . 有些ESB使用Java作为它们的实现语言,如Axis,Fuse,但它们足够强大,可以解析XML,协调服务,与大型机系统集成。在Message Broker中的Web服务设计和开发很容易,用户友好.ESQL正确指出对XML转换很有用,处理是Message Broker中使用的实现语言。 Again , integration with MQ , HTTP , File nodes is seamless and efficent in MB . 同样,与MQ,HTTP,File节点的集成在MB中是无缝且高效的。

First thing to understand is that the Java-API for Broker sits on top of the C-API and does not give you full access to all the available functionality. 首先要理解的是,Broker的Java-API位于C-API之上,并不能完全访问所有可用功能。

Secondly its Ugly, I would not use it for simple mapping transformations, and of course these days there is the visual mapper as well. 其次是它的丑陋,我不会用它来进行简单的映射转换,当然现在还有可视化映射器。

That said its still useful in special circumstances. 这说它在特殊情况下仍然有用。 One example where I used it was to match merge some message content. 我使用它的一个例子是匹配合并一些消息内容。 Basically the scenario was receive Msg1 containing 2000+ elements and then get a corresponding message Msg2 containing 2000+ elements that provided additional detail. 基本上,场景是接收包含2000多个元素的Msg1,然后获得包含2000多个元素的相应消息Msg2,这些元素提供了额外的细节。

So in ESQL you are reduced to starting with Msg1.element[1] and then scanning Msg2 for a match, to optimise you can delete elements from Msg2 as they get used up. 因此,在ESQL中,您将减少为从Msg1.element [1]开始,然后扫描Msg2以进行匹配,以优化您可以删除Msg2中的元素,因为它们已用完。 Still it was horrendously expensive in terms of CPU especially once things started to scale up from 2000+ to 5000+. 然而,就CPU而言,它仍然非常昂贵,特别是一旦事情开始从2000+扩大到5000+。 And it took a long time, over 5 minutes for really large messages. 对于非常大的消息,花了很长时间,超过5分钟。

The alternative was to use the Java compute node and load the content of the second message into a Java Tree object, this reduced the processing time to about 3 seconds. 另一种方法是使用Java计算节点并将第二条消息的内容加载到Java Tree对象中,这将处理时间减少到大约3秒。

So if you are just doing transformation steer clear of the Java compute node. 因此,如果您正在进行转换,请避开Java计算节点。 If however you are doing something more complex and/or CPU intensive then certainly give the Java compute node a try. 但是,如果您正在执行更复杂和/或CPU密集型的操作,那么请务必尝试Java计算节点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 通过消息代理进行 Java/Python 通信 - Java/Python communication via message broker Java-向WebSphere Message Broker发送消息并更改我的消息 - Java - sending a message to WebSphere message broker and its altering my message 如何判断 java.jms.TopicSubscriber 何时失去与消息代理的连接? - How can you tell when a java.jms.TopicSubscriber loses its connection to the message broker? 如何使用Java启动/停止Websphere Message Broker? - How to start/stop Websphere Message Broker using Java? 为Glassfish嵌入式Message Broker设置Java运行时环境 - Setting Java Runtime Environment for Glassfish Embedded Message Broker 如何停止Java方法,直到它从MQTT代理收到消息为止 - How to stop a java method until it receives a message from a MQTT broker 在 java/spring 中使用 SQL Server Service Broker 队列消息 - Consume SQL Server Service Broker queue message in java/spring 触发MQTT代理发布Paho Java客户端的消息 - trigger MQTT broker to publish will message with Paho Java client 使用Java api从消息代理栏文件中检索属性值 - retrieve property values from message broker bar file with java api 我可以在没有 Message Broker 的情况下使用 Spring Integration 吗 - Can I use Spring Integration without Message Broker
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM