In Init state (Dispatcher) downloading a file (based on record status in application) from an application and writing records to a Queue , say 10 queue items.
Processed first 2 queueitems successfully and also updates status in application.
While processing 3rd queuitem, due to system exception, 3 queueitem status updated to failed and 8 more queuitems left with new status.
Now when it goes to init state again due to system exception of 3rd queueitem, dispatcher again downloads the file (remaing 8 records) where were left out durign first run before system exception) and adding to queue (which were already added and in new status in first run before system exception).
Here, how to avoid writing the same records again with new status?
Shall we make all the new status queueitems to failed during first run itself, if there is any system exception?
Keep the entire process in First run of InitState instead of keeping it in InitAll Application xaml. This will avoid adding queue items again when an system exception occurs.
I am opening the application inside initAll applications, downloading the file and then writing to a Queue.
If I open the application initState, download the file and then writing to a Queue, then how do I open the application again when system exception? Could you please confirm the right place?
->Keep the entire process of dispatcher in the first run.
->When the process gets started then all the data in the first run will be added into the Queue.
->If a system exception is occurred in any of the Transaction Item then the Init state will be running again but the first run will not be executed because the first run will be executed only when the Config is empty. So when a system exception comes there will be some data already present in the Config. So, that’s the reason the first run won’t get executed again and in that way the adding of data again into Queue can be avoided.
→ Open the application in the first run and add the data into the queue. So, that even the system exception occurs the data won’t get added into the queue.
->In the init all applications state again use the opening of applications steps but in that xaml don’t use the downloading steps and adding the data into the queue. Just use the steps for opening of application in init all applications and give the option as If not open in the properties panel of the init all applications state. So that even the system exception occurs then it will try to open the application but it won’t add any data into the queue.
my current flow is closing when system exception occurs and opening again as going to initall applicaitons (currently my dispatcher is also in this block). below snap under settransactionstatus of system exception.
If you want to close the application then you can leave the steps in the same manner. If you don’t to close the application even the exception occurs then please give the option as close never in the properties panel of the Use Application/ Browser activity.
yeah… for my scenario… I have to close and open again as I need to get the next queuitem again and search for that queuitem caseid in application to proceed further.
If you want to close the application then please open the system exception as highlighted in the first screenshot and then add the killProcess activity in the place as highlighted in the second screenshot
You should combine the 10 queue items into a datatable, then use Bulk Add Queue Items to add them to the queue. You can set Bulk Add Queue Items to “all or nothing” so that if any item fails the whole batch is discarded and no queue items are created.
Simple for your case would be if you are not able to move the add queue items into if first run
then use if condition around the add queue items part and check tansactionnumber=1 …on then side use add queue items and on else side do nothing…so queue items are added only once
Remember as you are adding items in initallapplications you need to create one more argument transationumber and link it with transactionumber in the invoke workflow file