春季活动vs ActiveMQ [英] Spring Events vs ActiveMQ

查看:66
本文介绍了春季活动vs ActiveMQ的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Newbee进入春季世界.我对ActiveMQ有一些了解.最近在我的一个项目中使用.在阅读有关Spring Events的文章时,提出了一个疑问.

春季活动:发布者->侦听器.我们确实会发布事件,并且会为此创建一些侦听器.

ActiveMQ:发布者->侦听器.我们确实会发布事件,并且会为此创建一些侦听器.

因此,任何人都可以帮助我了解这两种API的用例或区别.

解决方案

据我所知, Spring Events application 级别的事件机制,以便我们的应用程序内部的不同部分可以进行通信/协调.范围和功能似乎分别很窄和很小.您可以同步(默认行为)或异步(使用@EnableAsync和@Async)发布事件并处理这些事件.没有经纪人.如果仅此功能,此功能可能非常适合您的应用程序.

另一方面, ActiveMQ 是功能齐全的消息代理.一般来说,它作为独立服务器进程运行(尽管它可以嵌入到您的应用程序中).它支持行业标准协议,例如AMQP,MQTT和&STOMP具有在多种平台和各种语言上的客户端实现.例如,您可以通过Websocket从Javascript客户端发送STOMP消息,并使用在Windows上用.NET编写的AMQP客户端处理这些消息.它同时提供了JMS和JNDI客户端实现.它支持发布-订阅和点对点语义.您可以将其用作集成平台,并使用各种协议将其扩展到具有高可用性的消息数据和数千个远程客户端的多节点群集,也可以将其嵌入到应用程序中,仅用于本地事件./p>

Newbee to Spring world. I have some knowledge on ActiveMQ. Recently used in one of my projects. While reading about Spring Events raised a doubt.

Spring Events: Publisher -> Listener. We do publish events and we would have created some listeners for that.

ActiveMQ: Publisher -> Listener. We do publish events and we would have created some listeners for that.

So anyone helps me to understand the use cases or difference between these two APIs.

解决方案

As far as I can tell, Spring Events are an application level events mechanism, so that different parts inside our application can communicate/coordinate. The scope and functionality appear to be quite narrow and small respectively. You can publish events and deal with those events either synchronously (default behaviour) or asynchronously (using @EnableAsync and @Async). There is no broker. This functionality may be a perfect fit for your application if this is all it needs.

On the other hand, ActiveMQ is a full-featured message broker. Generally speaking, it runs as an independent server process (although it can be embedded in your application). It supports industry-standard protocols like AMQP, MQTT, & STOMP which have client implementations on numerous platforms and in various languages. For example, you could send STOMP messages via Websockets from a Javascript client and process those messages with an AMQP client written in .NET on Windows. It provides both a JMS & JNDI client implementation. It supports both publish-subscribe and point-to-point semantics. You can use it as an integration platform and scale it up to multi-node clusters with high-availability for the message data and thousands of remote clients using various protocols or you can embed it into your application and just use it for local events.

这篇关于春季活动vs ActiveMQ的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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