Java – why choose JMS for asynchronous resolution? Why is it better than a simple entity bean?

In most of the projects I participated in, the choice of asynchronous solution has always been the source of a lot of discussion

A single entity bean is enough to manage one queue at a time: we only need to store one ticket in a table and process the cron queue This simple solution has very simple advantages. It is based on the transaction context of the database and can manage the state of received messages during execution

Therefore, I raise the following questions:

1) What are we interested in using JMS? What are the benefits of JMS?

2) Which case prefers JMS and entity beans?

Thank you for your response and feedback!

Solution

As long as there is only one consumer, your method is very good Otherwise, it will need a locking scheme so that the same message will not be delivered twice, etc This is out of the box provided by JMS: trade production and consumption with JMS agents, and manage all delivery issues with multiple consumers / producers

Other advantages of JMS are the quality of service and management, such as retransmission attempt, dead message queue, load management, scalability, clustering, monitoring, etc

JMS also supports publishing partitions or point - to - point

It's a bit like comparing JDBC statements to insert a row into the database with full orm Both can insert a row into the database, but ORM will provide more things, and you won't reinvent the wheel to deal with low-level problems... (the analogy is not very good, but very good)

I suggest you read the FAQ

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>