How to clean obsolete messages



I would like to "clean" queued messages from the database.

We are using ProcessAPI.sendMessage() to send messages to a process when some external event occurs, using the "correlation" feature to reach the right process instance.

The normal processing is that when the process reaches the target task, it will consume the message and do whatever is triggered by the event.

It happens that sometimes a message is never consumed, for example if the target task is already done, or if the external event occurs twice (we have no control on this).

The result is that these messages either 1) stay in the database and might accumulate, or worse 2) will be consumed at the wrong time by a newly created instance of the process having the same correlation data (while the first, actual target instance is already terminated for some time for example).

I know that these messages are kept because I noticed the 2nd effect, and I saw them in the message_instance table.

It would be useful to be able to remove all the messages having a given set of characteristics : process definition, task and correlation data.

I can't find any API method for that.

Is it possible ? Or how can I fix this problem ?

Thank you.

2 answers


Hello Sean,

I considered doing something like that but it is not possible, even if I could set up a dummy process that would catch these messages, I think that it would also steal the "normal" messages from the original process if some of them are queued and the dummy process is running.

And since the messages are sent to a specific task class (using process definition, task definition and correlation data) I can't see how to make a dummy catching process for these messages.

Thank you


Submitted by Sean McP on Mon, 05/30/2016 - 11:26

It shouldn't be a automated process. It should be a manual one where the operator could select one or more messages from the queue to remove. Then execute the dummy catch process against these selected messages. This would then do what you want.

We used to have this a issue with MQSeries and it was always a bit of a pain.



I think the method of doing this is rather than delete the message - catch the message with a dummy process which will then remove the message from the queue correctly.


PS: If this reply answers your question, please mark as resolved.