Re: Concurrent Consumption of Messages Putting a lock on attribute
Here's documentation for ActiveMQ 5.x, if that's what you're using.
On Thu, Dec 20, 2018, 10:04 AM Justin Bertram <jbertram@xxxxxxxxxx wrote:
> It sounds to me like you would want to put all the related messages into a
> single message group  together.
>  https://activemq.apache.org/artemis/docs/latest/message-grouping.html
> On Thu, Dec 20, 2018 at 8:18 AM drunkKnight <upadhyaya.piyu@xxxxxxxxx>
> > I have multiple servers that store 10000 users on each. Earlier because
> > less time, I was using a Pub/Sub model for different events. It worked as
> > follows:
> > Consider the case, where I had to do an OTP verification for a user then
> > would write it in DB and later the event to be executed in the DB by a
> > job and this way it gets consumed.
> > Now I want to switch to MQs. I am pretty clear with the implementation
> > but there is a small problem where I got stuck.
> > So the story is:
> > Consider a user A, on user's onboarding I create events like OTP,
> > EmailVerification, and AllocateBonus. I'm planning to create a shared
> > between multiple servers that would have the messages (with an attribute
> > user-id) in the queue and will also publish it to a topic (where the
> > will be the user-id) and a consumer will consume the topic. Once the
> > gets emptied, it will get deleted.
> > Now the problem is: consider the user A with messages like
> > EmailVerification
> > and AllocateBonus. Consumer 1 takes up the EmailVerification event, looks
> > for the user-id in it and then looks for the events in TOPIC- A. At the
> > same
> > time, consumer 2 takes up the event AllocateBonus and looks for the
> > in it and then starts executing it.
> > So before consumer 1 gets completed, consumer 2 will finish and there
> > be no bonus allocated to the user because email is not verified.
> > PROBLEM: I want to acquire a lock on an attribute of the message so that
> > the
> > events of the same user-id does not get executed by different consumers
> > without maintaining the order of execution. I have looked up for this but
> > could not find anything. Is there anyone here who is aware of such
> > functionality in ActiveMQ? It would be of great help.
> > Thanks,
> > --
> > Sent from:
> > http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html