It may happen so that TASK2 reaches my server before TASK1 but I have to process TASK1 first before TASK2.
I am thinking of the below approach to fix this issue:
1. TASK2 got ENQ'd and TASK1 is waiting
2. In TASK2, check if TASK1 already executed.
3. If TASK1 not executed still, then issue DEQ and issue ENQ again (coded inside Task2)
My expectation is that when I DEQ, TASK2 is DEQ'd (but not over yet) and TASK1 will get ENQ'd and gets completed. TASK2 will get processed once TASK1 is over.
Please post your opition and revert if you have a better solution.
How do you know that a given TASK1 relates to a given TASK2 ?
What time could elapse between a given TASK2 arriving and its associated TASK1 arriving (where they arrive out of sequence) and how do propose to handle an excessive time interval? The same applies where TASK1 arrives and is processed but TASK2 never arrives or arrives too late.
Can there be multiple sets of TASK1 and TASK2 interleaved?
Correct the source, why is task2 is coming up early then task1 ? should this not be listed as a part of your requirement? is it a bug?
3)If TASK1 not executed still, then issue DEQ and issue ENQ again (coded inside Task2)
What is the interval between these two tasks? what if task1 doesn't comein given interval ? what happens to task2?
So it is a FIFO, ask an external party to correct this issue.
How big is the commarea? if you have a DB2 then save them else save it on a file or TSQ. Now using START you can trigger a process which will read this tasks and untill task1 and task2 or only task1 is found execute it otherwise find what is time interval you want to wait for task1 and if it does not come then rollback task2 and inform your third party about why task1 is missed?