rabbitmq - JMS rewrite message -


i know jms messages immutable. have task solve, requires rewrite message in queue entity id. maybe there problem system design, me please.

app sends message (with entity id = 1) jms. app b checks new messages every minute.

app might send many messages entity id = 1 in minute, app b should see last one.

is possible?

  • app should work fast possible, don't idea perform removematchingmessages(string selector) before new message push.

imo approach flawed.

even if did accept clearing off queue using message selector remove messages entity id = 1 before writing new message, timing becomes issue: it's possible whichever process writes out-dated messages need complete before new message written, level of synchronization.

the other solution can think of reading messages before processing them. every minute, thread takes messages , bucketizes them. earlier entity id = 1 message replaced later one, @ end have unique set of messages process. process them. of course might have many messages in memory @ once, , transactionality gets thrown out window, might achieve want.

in case reading messages come in , bucketizing them, , once minute run processing logic. make sure synchronize buckets aren't changed out under new messages come in.

but overall, not sure it's going work


Comments