RE: Workflow message processing job error at every 10th min (recursively).
Hi,
I've just fixed the same problem in my environment.
I found that there was and orphan record in SYSWORKFLOWMESSAGETABLE without a matching record in SYSWORKFLOWTABLE.
The problem sits in the method \Classes\SysWorkflowQueue\dispatch. the method iterates the messages from the queue one by one. If the message doesn't have a matching workflow, the method just throws an exception and leaves the remaining messages in queue unprocessed.
In fact you can verify the workflows that are stuck with the query below:
select
a.RECID, b.INSTANCEID, b.INSTANCENUMBER, a.BATCHAFFINITY, a.MESSAGETYPE, a.*, b.*
from SYSWORKFLOWMESSAGETABLE a
join SYSWORKFLOWTABLE b on a.PARTITION = b.PARTITION and a.ROOTCORRELATIONID = b.ROOTCORRELATIONID
where a.MESSAGELIFECYCLESTATE = 1
order by a.RECID asc
In my case the message was linked to a claim that was already completed (weird!).
You can use the query below to find the orphans.
SELECT
b.INSTANCENUMBER -- this should be null for orphans
, a.RECID -- recid or the orphan message
, a.WORKFLOWCONTEXTTABLEID
, a.WORKFLOWCONTEXTRECID
--, e.EXPNUMBER
, a.*
from SYSWORKFLOWMESSAGETABLE a
left join SYSWORKFLOWTABLE b on a.PARTITION = b.PARTITION and a.ROOTCORRELATIONID = b.ROOTCORRELATIONID
--left join TRVEXPTABLE e
--ON a.PARTITION = e.PARTITION
--AND a.WORKFLOWCONTEXTRECID = e.RECID
where a.MESSAGELIFECYCLESTATE = 1
AND b.recid IS NULL
--AND a.WORKFLOWCONTEXTTABLEID = 484
Then just delete the messages returned by the query above using the RECID:
DELETE FROM SYSWORKFLOWMESSAGETABLE WHERE RECID = <add your recid here>
Hope this help!