Monitor Events, Orchestrator stopping controls

Hi,

I’m planning on a process which is meant to run from orchestrator.

The process itself includes Monitor events + File change trigger for the folder (For new files only). I want it to run “Forever”. The monitoring part is quite simple, but about the orchestrator part, Is there in orchestrator automatical stopping control for Monitor events (if the repeat forever is True) or should I involve Should stop activity or something else similar to my process for stopping controls for orchestrator. Does anyone have any experience/tips about this kind of situation?

Br, Joni

You’re probably best off including a should stop check that is sent from Orchestrator at some point in your iteration. If you are unsure about checking every iteration as it may slow the process down, you could track the loop count of the coordinator process and do something similar to the following:

int c = 0;
int const = 1;
while (const == 1) { //Your continuous loop to watch trigger events etc
    //File Triggers/Triggered Processes, etc
    if (c%50 == 0) {
        c = 0;
        bool shouldStop = CheckShouldStop();
        if (shouldStop == true) {
            const = 2;
        }
    }
    c += 1;
}

I would say to use a break or something for the Should Stop check, but last I checked they only work with for each loops.

1 Like