A user-defined input node that is written in the C programming language progresses through several stages during its lifetime.
During the registration phase, the broker discovers which resources are available and which LILs can provide them. In this instance, the resources available are nodes. The phase starts when an execution group starts. The LILs are loaded on the startup of an execution group, and the broker queries them to find out what resources they can provide.
A CciFactory structure is created during the registration phase, when the user-defined node calls cniCreateNodeFactory.
An instance of a user-defined input node is created when the mqsistart command starts or restarts the execution group process, or when a message flow that is associated with the node is deployed.
Your user-defined input node only has input terminals if it is also acting as a message processing node. If this is the case, it is typically better to use a separate user-defined message processing node to perform the message processing, rather than combine both operations in one, more complex, node.
During this phase, a CciTerminal structure is created when cniCreateTerminal is called.
The processing phase begins when the cniRun function is called by the broker. The broker uses the cniRun function to determine how to process a message, including determining the domain in which a message is defined, and invoking the relevant parser for that domain.
A thread is demanded from the message flow's thread pool, and is started in the run method of the input node. The thread connects to the broker's queue manager, and retains this connection for its lifetime. When a thread has been allocated, the node enters a message processing loop while it waits to receive a message. It remains in the loop until a message is received. If the message flow is configured to use multiple threads, thread dispatching is activated.
The message data can now be propagated downstream.
A user-defined input node is destroyed when the message flow is redeployed, or when the mqsistop command is used to stop the execution group process. You can destroy the node by implementing the cniDeleteNodeContext function.
When a user-defined input node is destroyed in one of these ways, you should free any memory used by the node, and release any held resources, such as sockets.