Startup Task
Hi,
I would like to know how to start Object gateway automatically when Ensemble starts up. Is there a way we can include it as part of Start up settings?
Thanks
Ramesh
Comments
One way is to create a SYSTEM^%ZSTART subroutine and put some COS code in there. Read the doc here about how to do this.
Take care to read the documentation carefully. For example, if your SYSTEM^%ZSTART causes an error your environment startup could fail. Here's a simple error handler to wrap your startup actions in:
try {
// Your code here
}
catch e {
d ##class(%SYS.System).WriteToConsoleLog("SYSTEM^%ZSTART error: "_e.AsSystemError(),,1)
}Also note that if you are using InterSystems mirroring you may want to run your startup code only on the primary. In that case I recommend creating/editing the ZMIRROR routine in %SYS (on all mirror nodes) and using its NotifyBecomePrimary entrypoint instead of SYSTEM^%ZSTART. Another benefit of NotifyBecomePrimary is that it only runs after the databases are ready to be written to. In contrast, in a mirroring configuration SYSTEM^%ZSTART runs at a point where the databases are readonly.
Thanks John. This really helps!!