C user-defined input node life cycle

A user-defined input node that is written in the C programming language progresses through several stages during its lifetime.

The stages of the life cycle are:
  • Registration
  • Instantiation
  • Processing
  • Destruction

Registration

During the registration phase, the integration node discovers which resources are available and which LILs can provide them. In this instance, the resources available are nodes. The phase starts when an integration server starts. The LILs are loaded on the startup of an integration server, and the integration node 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.

The following APIs are called by the integration node during this stage:
  • biGetMessageflowNodeFactory
  • bipGetParserFactory
The following API is called by the user-defined node during this stage:
  • cniCreateNodeFactory

Instantiation

An instance of a user-defined input node is created when the mqsistart command starts or restarts the integration server process, or when a message flow that is associated with the node is deployed.

The following APIs are called during this phase:
  • cniCreateNodeContext. This API allocates memory for the instantiation of the user-defined node to hold the values for configured attributes. This API is called once for each message flow that is using the user-defined Input node.
  • cniCreateInputTerminal. This API is invoked within the cniCreateNodeContext API, and is used to tell the integration node what input terminals, if any, your user-defined input node has.

    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.

  • cniCreateOutputTerminal. This API is invoked within the cniCreateNodeContext API, and is used to tell the integration node what output terminals your user-defined input node has.
  • cniSetAttribute. This API is called by the integration node to establish the values for the configured attributes of the user-defined node.

During this phase, a CciTerminal structure is created when cniCreateTerminal is called.

Processing

The processing phase begins when the cniRun function is called by the integration node. The integration node 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 integration node'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.

The following APIs are called by the integration node during this phase:
  • cniRun. This function is called by the integration node to determine how to process the input message.
  • cniSetInputBuffer. This function provides an input buffer, or tells the integration node where the input buffer is, and associates it with a message object.

Destruction

A user-defined input node is destroyed when the message flow is redeployed, or when the mqsistop command is used to stop the integration server 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.

The following APIs are called by the integration node during this phase:
  • cniDeleteNodeContext. This function is called by the integration node to destroy the instance of the input node.