Lifecycle of a NODEJSAPP bundle part
In CICS, a NODEJSAPP bundle part manages the lifecycle of a Node.js application. Each NODEJSAPP bundle part manages a single Node.js application and a single instance of Node.js runtime.
Enabling a NODEJSAPP bundle part
You can use CICS Explorer or the CEMT SET BUNDLE command to enable the CICS BUNDLE that contains the NODEJSAPP bundle part.
When a Node.js application bundle part is enabled, CICS starts the Node.js runtime and invokes the initial JavaScript file that is specified by the NODEJSAPP. CICS then sets the status of the bundle part to ENABLED. CICS is not aware of when the application is ready to accept work.
If an error occurs when starting the Node.js runtime, for example, an error in the Node.js profile or application, CICS sets the status of the bundle part to DISABLED.
Disabling a NODEJSAPP bundle part
- Either, the application completes normally and CICS sets the status of the bundle part to DISABLED.
- Or, the bundle part enters the DISABLING state because the CICS bundle has been disabled.
When a NODEJSAPP bundle part enters the DISABLING state, CICS sends the SIGTERM signal to the Node.js process. This allows the application to receive the signal and shut down gracefully as described in Developing Node.js applications.
After a set period (controlled by the NODEJSAPP_DISABLE_TIMEOUT Node.js profile option),
if the application does not terminate of its own accord, CICS sends the SIGKILL signal to the Node.js process. This forces the Node.js runtime to terminate immediately. However, system resources
(such as Unix Message Queues) might not be deallocated on termination. Applications are encouraged to react to the SIGTERM notification, failure to do so might result in a leakage of system resources over time.
Once the Node.js runtime has terminated, CICS waits until all tasks started by invoke requests using the locally optimized API have ended. Then the NODEJSAPP bundle part enters the DISABLED state.