Hello,
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.