为什么选择异步解决方案JMS?为什么它不是一个简单的实体bean更好? [英] Why choosing JMS for asynchronous solution ? Why is it better than a simple entity bean?

查看:174
本文介绍了为什么选择异步解决方案JMS?为什么它不是一个简单的实体bean更好?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我参加过的大多数项目,一个异步解决方案的选择上一直备受讨论的源泉......

每一次单个实体bean足以管理一个队列:我们只是存储在一个表中的信息(门票)和处理的cron unstacks队列中。这个简单的解决方案具有的是非常简单的优点,它是基于数据库的事务上下文,我们可以在其执行期间管理接收到的消息的状态。

因此,我提出以下问题:

1),我们有什么兴趣使用JMS?什么是JMS的好处是什么?

2)在什么情况下prefering JMS对实体bean?

感谢您的回复和反馈!


解决方案

  

1),我们有什么兴趣使用JMS?
  什么是JMS的好处? 2)在
  这情况prefering与JMS
  实体bean?


您只要有只是一个消费者办法效果很好。否则,将需要一个锁定方案使同一邮件未送达两次,等等,这是什么样的JMS提供开箱即:办理生产和消费与JMS代理管理所有的有多个消费者/生产者交付问题的。

JMS的其它优点是服务质量管理,例如交还的尝试,停用消息队列,负荷管理,可扩展性,集群,监测等。

JMS也支持发布 - subsribe或点至点。

这是一个有点像一个比较JDBC语句插入数据库一行与一个功能完善的ORM。这两个工作插入行的分贝,但ORM会提供更多的,再加上你不要重新发明轮子应对低层次的问题... (这个比喻是不是很大,但井)

我建议你看一下常见问题解答

In most projects I have participated, the choice of an asynchronous solution has been a source of much discussion ...

Each time a single entity bean was enough to manage a queue: we just store a message (ticket) in a table and a processing cron unstacks the queue. This simple solution has the advantage of being very simple, it's based on the transactional context of the database and we can manage the state of the received message during its execution.

I therefore ask the following questions:

1) What interest we have to use JMS? What are the benefits of JMS ?

2) In which situation prefering JMS versus entity bean ?

Thank you for your responses and feedback!

解决方案

1) What interest we have to use JMS? What are the benefits of JMS ? 2) In which situation prefering JMS versus entity bean ?

You approach works well as long as there is only one consumer. Otherwise it will require a locking scheme so that the same message is not delivered twice, etc. This is what JMS offers out of the box: transacted production and consumption with the JMS broker managing all the delivery issues with multiple consumers/producers.

Other advantages of JMS are quality of service and management, e.g. redelivery attempt, dead message queue, load management, scalability, clustering, monitoring, etc.

JMS also support publish-subsribe or point-to-point.

It's a bit like comparing a JDBC statement to insert one row in database vs. a full-fledge ORM. Both work to insert a row in the db, but the ORM will provide a lot more, plus you don't re-invent the wheel to deal with low-level issues... (the analogy is not that great but well)

I suggest you look at the FAQ.

这篇关于为什么选择异步解决方案JMS?为什么它不是一个简单的实体bean更好?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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