JMS alternative

I read a blog, and one of the points was β€œif you use queues, you messed up,” in the context of JMS.

I thought we even need JMS? A simple alternative would be if you need to do something asynchronously, why not just put the job request in a table somewhere and run some db polling process every X time units looking for new jobs?

This approach is simpler than JMS, it is easy to understand and basically removes application dependency.

What do I lose if I use the alternative that I described? Perhaps someone loses the ability to use JMX to administer things, but if your job queue is β€œloaded” from a table, you can write simple code to β€œmanage” the processing.

+3
source share
4 answers

I read a blog, and one of the points was "if you use queues, you messed up," in the context of JMS.

This is simply wrong.

You may be mistaken when choosing to use a queue when this is not appropriate, but if it is a JMS, this is a great choice.

I would be more attentive to what I read on the Internet if I were you. It seems to me that the author liked to make inflammatory statements in order to revitalize his blog and raise his Google Analytics statistics. This is one opinion of man, nothing more.

The survey solution is more complex, wasteful CPU cycles, but not real time, in my opinion.

You can use Executor or FutureTask if you want asynchronous processing. These would be reasonable queue alternatives if asynch is all you need.

+3
source

java.util.concurrent.

, , ( ) , .

JMS- .

( JMS) - , , . , " ", . . , , , .

( ). " " .

1) " ", , "done" ( ). 2) - , "" , "" . , " " , , , "" , .

, , , . "job submiter" "job processor" , . " " ( , , , ), , "" .

JMS .

, , . - .

0

, JMS, .

, , . , , " ".

(, JMS) - 1M msgs/sec, : , . , 2 , 3 , 4 ..

0
source

Source: https://habr.com/ru/post/1791109/


All Articles