为什么以及何时应该使用异步消息传递(如JMS或AMQP)? [英] Why and when should we use asynchronous messaging like JMS or AMQP?

查看:65
本文介绍了为什么以及何时应该使用异步消息传递(如JMS或AMQP)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从概念上讲,什么时候应该使用异步消息传递?又为什么呢?我们不能将消息内容存储到某些数据库存储中,并且为了执行这些消息而迅速地运行计划的作业吗?

Conceptually speaking, when should we use asynchronous messaging ? And why? Couldn't we store message contents to some DB Store and evetually running a scheduled job in order to process those messages ?

例如,使用JMS或AMQP为系统开发带来了真正的优势?有没有一种方法可以简化此设计并获得相同的结果?

Using JMS or AMQP, for example, brings real advantages to systems development ? Is there a way to simplify this design and obtain same results ?

推荐答案

很快,是的,如果速度和其他资源(例如,CPU/RAM)适合您的需要,则可以改用DB.作为任何专业的解决方案,JMS都可以最大程度地有效解决特定类别的任务-异步消息传递.

Shortly, yes, you can use DB instead if it fits your needs by speed and other resources like (CPU/RAM). As any specialized solution, JMS allows you to maximally effictively solve the specific class of tasks - asyncronous messaging.

此外,例如,使用JMS,您可以拥有一些开箱即用"的可伸缩性解决方案:您可以从不同的服务实例订阅单个队列中的事件,因此JMS将根据性能自动进行负载平衡您的事件处理器服务.

Also, for example, using JMS you can have some sort of scalability solutions "out of the box": you can subscribe from different instanses of service to events from single queue, so the JMS will do load balancing autimatically depending on performance of your event processor services.

除了队列,这里还有另一个有用的对象-主题.它们对于同时向多个订阅者广播事件很有用,因此您需要自己实现.

Along with queues there are another useful objects here - topics. They are useful to broadcast events to several subscribers simultaneously, so you'll need to implement it by yourself.

这篇关于为什么以及何时应该使用异步消息传递(如JMS或AMQP)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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