cniDispatchThread
Use this function to dispatch a new message flow thread to call another thread instance to run the user-defined message flow input node.
This message flow thread is allocated from a pool of threads
maintained for each message flow, under control of the Additional Instances property of the
message flow. If no threads are available because they are all in
use, CCI_SUCCESS is returned, and returnCode is
set to CCI_NO_THREADS_AVAILABLE. This value is not an error, but represents
one of the following causes:
- The message flow was not configured to run with additional threads.
- All additional threads configured are currently running.
The cniDispatchThread function can be called only from an input node. If it is called at any other time, CCI_FAILURE is returned and returnCode is set to CCI_INV_NODE_ENV.
Syntax
int cniDispatchThread(
int* returnCode,
CciNode* nodeObject);
Parameters
returnCode
- The return code from the function (output). Possible return codes are:
- CCI_SUCCESS
- CCI_EXCEPTION
- CCI_NO_THREADS_AVAILABLE
- CCI_INV_NODE_OBJECT
- CCI_INV_NODE_ENV
nodeObject
- The address of the node object that is run when the integration node creates or reuses the thread. This parameter is passed to the node when its cniCreateNodeContext implementation function is called (input).
Return values
- If a thread was successfully allocated, CCI_SUCCESS is returned, and returnCode is set to CCI_SUCCESS.
- If a thread could not be dispatched because insufficient threads are available in the message flow thread pool to satisfy the request, CCI_SUCCESS is returned and returnCode is set to CCI_NO_THREADS_AVAILABLE.
- If the function was not called in an input node, CCI_FAILURE is returned, and returnCode is set to CCI_INV_NODE_ENV.
- For all other error conditions, CCI_FAILURE is returned, and returnCode indicates the reason for the error.
Example
cniDispatchThread(&rcDispatch, ((NODE_CONTEXT_ST *)context)->nodeObject);