Written by

Senior Cloud Architect at InterSystems
Question Eduard Lebedyuk · Jul 19, 2019

Can I determine inside Ensemble Job that Ensemble tries to shut down the job

From inside Business Service (OnProcessInput method specifically) I want to determine if Ensemble tries to shut down the job.

Is it possible? How?

Comments

Robert Cemper · Jul 19, 2019

ENSEMBLE may have some signal mechanic.

BUT at Caché level you still have Special Variable $HALT as the last chance handler.
all details https://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=RCOS_vhalt

Most important: 

If you have $HALT set and also have code defined for ^%ZSTOP when a HALT is issued, the $HALT is executed first. $HALT can prevent the termination of the process, if its halt trap routine does not contain a HALT command.   !!!!

0
Sourabh Sethi · Jul 19, 2019

Hi Eduard,

I don't think you can do this in onProcessInput but when the corresponding job dies, it will definitely call onTearDown. 

So you can try overriding this method to execute something when Business Service is shut down.

I never tried this, but I think this should work.

Regards,

Sourabh

0