O INSTANCESTOPPING faz uma verificação para ver se uma solicitação para parar um fluxo de mensagens f oi feita, e retorna um valor booleano de true se a solicitação foi feita.
A função fluxo de mensagens retorna TRUE se um pedido para parar todo o processamento em um fluxo de mensagens foi feito, caso contrário, retorna FALSE.
/*
* Do not code loops like this as it never increments loopCounter
* but with the INSTANCESTOPPING() check it would exit when the flow is stopped
*/
declare loopCounter integer 0;
INFINITE_LOOP : WHILE (loopCounter < 1000) DO
IF (INSTANCESTOPPING() = TRUE) THEN
LEAVE INFINITE_LOOP;
END IF;
END WHILE INFINITE_LOOP;