cniGetAttribute2

This function gets the value of an attribute on a specific node instance. It is invoked by the message broker after all of the attributes that the user deploys are set. The results are written to the broker's persistent configuration store in order to ensure that the node is configured correctly after the execution group process is stopped and started.

The responsibilities of the node at this point are to:
  1. Return a character representation of the attribute value.
  2. Throw an exception if an error occurs.

If both cniGetAttribute and cniGetAttribute2 are implemented, cniDefineNodeClass fails with CCI_INV_IMPL_FUNCTION.

Defined In Type Member
CNI_VFT Optional iFpGetAttribute2

Syntax

CciSize cniGetAttribute2(
  int          returnCode,
  CciContext*  context,
  CciChar*     attrName,
  CciChar*     buffer,
  int          bufsize);

Parameters

context
The address of the context for the instance of the node, as created by the node and returned by the cniCreateNodeContext function (input).
returnCode (output)
Pointer to an int. On return, the node should ensure that this int stores a value that describes the status of completion. Possible return codes are:
  • CCI_SUCCESS
  • CCI_ATTRIBUTE_UNKNOWN
  • CCI_BUFFER_TOO_SMALL
attrName
The name of the attribute for which the value is to be retrieved (input).
buffer
The address of a buffer into which the attribute value is copied (output).
bufsize
The length, in CciChars, of the buffer specified in the buffer parameter (input).

Return values

  • If successful, the attribute value is copied into the supplied buffer and the number of CciChar characters copied is returned.
  • If the buffer is not large enough to contain the attribute value, returnCode is set to CCI_BUFFER_TOO_SMALL, and the number of CciChars required is returned.
  • If the attrName is not known to this node, returnCode is set to CCI_ATTRIBUTE_UNKNOWN.