I have an unnatended workflow that logs in to a portal, checks for “pending” intances and process them until there are no left. It runs three times a day, with a trigger defined so that after 8 hours of working Orchestrator kills the job, and the code is written so that if all instances were processed the bot waits for 5 minutes and the starts checking again. All for those 8 hours, then its killed.
This does the work, there are no instances missed and data is coherent, but from Orchestrator i see all those jobs as “stopped” instead of “complete”, and Its driving me crazy.
I am not allowed to modify the base code of the bot due to corporative constraints (I sense this should have originally be designed using queues), but I would like to know If I could modify something in the sequence that “waits 5 minutes”, and instead of waiting and looping, uploads a new trigger for the same process, and then terminate the workflow. In that scenario (I think) the bot would complete the work(with all pending instances finished), set a trigger for 5 minutes later in Orchestrator, terminate the job (thus stating the job as complete) and in minutes start all over again.
My questions:
Do queues manage jobs as a transaction?
Can I, for example, create a queue for this process so just before ending the job it adds a new job of itself to the queue so as soon as it logs out the new job takes place (and so on and so on)?
It sounds like the trigger is set to Kill instead of Stop, which is an improper way of doing this. Kill is like killing a process in Windows Task Manager - it just immediately kills it without any regard for anything else. You should set the trigger to Stop instead of Kill, and then use the Should Stop activity inside the automation so it detects when Orchestrator has told it to stop, moves to an “end process” sequence (with nothing after it) and therefore completes gracefully.
Yes, you can create a queue-based trigger that, as soon a new transaction is created on a queue, a new job will be executed based on the trigger settings.
Can I, for example, create a queue for this process so just before ending the job it adds a new job of itself to the queue so as soon as it logs out the new job takes place (and so on and so on)?
You can, but you have to create a new automation for it or changing the current one. Then you would use the “Create New Queue Item” activity, and set a defer time on the activity properties
I inserted a “should stop” at the end of the loop, the process stopped instead of being killed. But Orchestrator still shows me the job as “stopped”, and I want it to finish it. I think I am going to try the queue approach.
I assume you have an If that looks at the result of Should Stop and then does something, yes? I’m guessing you have a Terminate Workflow activity. That’s incorrect. What you want it to do is just go to a sequence where there is nothing else after it. A job stops successfully as completed when there are no more activities to process.
For example, various situations result in this automation going to End Process, which does some things like sending email, logging, etc and that’s it. There is nothing else to process after this sequence.
Thanks a lot Paul, this was really helpful with understanding the correct flow. The design on the flow in the process I am working with is dated and poorly constructed. I am trying to make it a little bit better but I cant afford building it again from scratch. With your insight I put the “should stop” in the right place and also built a little flow so It can work with a queue and now the robot sets a new transaction for itself (for 30 minutes later) every time it finishes checking for new instances.