Hi,
So, I have 2 modules developed. module A and module B. Module B is dependant on module A.
Module A declares some APIs that I need to use in module B. I was assuming that when modules are loaded the setup()
method for each module will be called, then each startup()
method.
When a module is dependant on other module, it seems that module A goes through its entire lifecycle (setup()
-> startup()
) before module B.
Is there anyway I can prepare some APIs in module A setup()
, then have module B setup()
do some registering of said APIs, then module A calls it startup()
method?
I don't think this is possible, but I wanted to make sure.
Thanks,
Tom
I think you've diagnosed this incorrectly.
You will see this order:
A.setup()
B.setup()
A.startup()
B.startup()
The dependency of B on A ensures A is setup before B, but all modules have setup()
called before all modules have startup()
called.
Hi Kevin,
This doesn't look to be the case. If I install module A then module B. Once I restart module A. This is the sequence I get. I put a breakpoint in each method.
A.setup()
A.startup()
B.setup()
B.startup()
Does the sequence change when restarting modules, opposed to restarting the gateway?
For clarity, I tested restarting the gateway instead of the parent module and the sequencing turned out as you said. So, it looks like when restarting the parent module the sequencing is different.
Yeah, looks like the behavior is different when restarting a module than it is during gateway startup.
This is arguably incorrect, at the very least inconsistent, but unlikely to get changed.
In Ignition 8.3 there is no module hot loading, so it should at least be consistent there.
1 Like
That is a shame. Don't suppose you can think of a solution to this? Restarting the gateway isn't always going to be possible once we ship this project.
In either scenario B.startup() is called after A.startup(), so you can try to figure out how to rely on that.
Installing your module happens what, once? Restarting modules shouldn't be part of any regular workflow.
I see users upgrading modules on the fly pretty regularly. Common practice, and very handy on critical systems. (For 3rd party modules--meaningless for IA modules.) That this is not possible in v8.3 is a trade-off, not an unalloyed win, for the ecosystem as a whole.
1 Like
I don't disagree with this. It just is what it is now :-/
2 Likes