What I have observed in the wrapper.log is that when the gateway is shutdown, it does not FIRST fire the gateway shutdown event. It does that later.
In my case I just happened to have some scripting running when the gateway shut down.
Usually this script takes about 3 seconds to execute. It executes randomly.
So there is a chance that it could be in the middle of execution when the gateway shuts down.
That is exactly what occurred at this time!
However what I noticed is that an exception was raised first.
Then 5 seconds later, the Gateway shutdown event was fired.
I can understand this exception firing since it was executing when the gateway was shut down.
But I would think that the next thing to occur would be the PROJECT gateway shutdown scripts
That is not the case.
I did not receive a project gateway shutdown script until 5 seconds AFTER the exception was raised.
In between that time, in the wrapper.log file, the gateway was stopping a lot of modules and such.
From these observations, I am thinking that when the gateway shuts down, it just starts shutting down
and then RANDOMLY fires the project gateway shutdown events whenever it wants to. Regardless
of where it is at in it’s shutdown order. It might be the case that some modules are shutdown before a project gateways shutdown event occurs! Which is what I experienced.
What happens when a gateway shuts down?
Does it first start to go through all modules and shut them down, then disconnect gateway networks, then shutdown opc connections etc.
Maybe I could detect the FIRST thing that the gateway does during a shutdown and use that as my
way to tell when the gateway is shutting down?