Same Message is picked more than once.

38 views
Skip to first unread message

meg...@gmail.com

unread,
Apr 7, 2015, 7:33:44 AM4/7/15
to nginn-me...@googlegroups.com

We have a scenario where a new message will call the stored procedure which is a long running operation for more than few minutes . (Lets say 10 minutes.)
While that operation is going on the SubQueue status is still 'I' which is fine because its currently being processed.

But however after a minute or so the same message is again picked up by the Nginn. and it calls the SP again....   (Remember the first long running operation is still running)

How can I avoid this duplication call? I tryed to set an additional SubQueue Status 'P' manually (Currently being process.)  Hoping that the Nginn would see the status as different from 'I'
So won't pick that up again - When the current long running process is finished Nginn will automatically change it to X /R/F depending on its output.
But that did not work. 

Can some one please tell me - How can I avoid this duplication call please ?  

I would have thought its a very basic need - I am missing something fundamental here.


Thanking you in advance.
Regards
Mega

Rafal Gwizdala

unread,
Apr 7, 2015, 10:54:40 AM4/7/15
to nginn-me...@googlegroups.com
Hi Mega

I suspect this has something to do with the transaction timeout. Each message is received in a transaction and SQL server holds a lock on message record during the transaction so no one else can pick the message. But the transaction can time out and then SQL server will roll it back and release the lock on the message, allowing other thread to handle it again. 
Transaction timeout is configured with
MessageBusConfigurator.SetReceiveTransactionTimeout
and by default it's set to 1 minute 
I don't know your code and have no idea why stored procedure you mentioned appears to keep going even after the message transaction timed out, maybe it's not a part of same transaction or executes some non-transactional operations - please give more details in next posts, if the problem remains unsolved.

Now you could increase the transaction timeout to say 20 minutes and hope this is enough, but I'm not sure if this is the right solution (usually a transaction should complete in couple of seconds). But please try doing that and see what happens. The alternative way of solving that would be to handle the long-running work in a separate transaction, and only initiate it with a message on message bus (+ monitoring the status/completion and retrying in case the operation is interrupted in the middle).

Best regards
Rafal

--
You received this message because you are subscribed to the Google Groups "nginn-messagebus" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nginn-messageb...@googlegroups.com.
To post to this group, send email to nginn-me...@googlegroups.com.
Visit this group at http://groups.google.com/group/nginn-messagebus.

Reply all
Reply to author
Forward
0 new messages