Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JMS: modulus operator in message selector

I want to load balance JMS messages using message selectors.

A message has a property "EntitiyIX".

The selectors shall be like:

"EntitiyIX Modulus 2 == 0" ==> route to queue A
"EntitiyIX Modulus 2 != 0" ==> route to queue B

What's the operator to calculated the modulus in a JMS message selector?

Thanks, Alex

like image 270
Alex Avatar asked Apr 19 '26 15:04

Alex


1 Answers

Assuming that the property is an integer, then I believe you could do

  • (EntityIX / 2) = ((EntityIX+1) / 2) -> route to A
  • (EntityIX / 2) != ((EntityIX+1) / 2) -> route to B
like image 108
Robin Avatar answered Apr 22 '26 06:04

Robin