CN

??????????????????????


????????????????????????MessageListenerOrderly??????????????


??????????????????10????????????????????????????????????10-30??????????????????????????????????30-100????????????????????????????????100????????????????????????????


??????????????????????MessageListenerOrderly????????????100????????????(??????????)??????????100????????????????????100??????????????????????????????????(????????)??????????100??????????????????????MessageListenerConcurrently????????????


????????????????????????1-10??????????????1????10-30??????????????2????30-100??????????????3????100+??????????????4??????????????????????????????????????????????????????????(????????1??10??????????????????)????????????????????????????(????2??????????1????)??????


??????????????????MessageListenerPeriodicConcurrently????????????????????????????????????????????????????????????????


EN


Dear masters, Hello!

Let me give an example to illustrate the waste of performance caused by 
`MessageListenerOrderly`.

For example, for e-commerce activities, the first 10 orders can get an extra 
laptop, the first 10-30 orders can get an extra tablet, the first 30-100 orders 
can get an extra mobile phone, and after 100 orders, there is no extra reward.

In this scenario, when you use `MessageListenerOrderly`, you can guarantee the 
order of the first 100 orders (single read-write queue) and the order after 100 
orders. In fact, the order after 100 orders is unnecessary (meaningless), that 
is to say, the order after 100 orders should be consumed by 
`MessageListenerConcurrently`.

Furthermore, suppose we call the interval from 1 to 10 stage 1, the interval 
from 10 to 30 stage 2, the interval from 30 to 100 stage 3, and the interval 
from 100 + stage 4. Because the reward of each stage is the same, in fact, 
concurrent consumption can be made in stages (for example, 10 messages in stage 
1 can be consumed concurrently). We only need to ensure the order between 
stages (stage 2 must be after stage 1).

To sum up, I propose `MessageListenerPeriodicConcurrently`, which can ensure 
the sequence between phases and consume concurrently within phases, greatly 
improving the performance.

Reply via email to