An introduction to the message-related APIs in the header file c8messages.h, including their purposes and parameters.
A C8_MESSAGE_TYPE describes whether a message is entering or exiting an internal window.
Most adapters will use C8_MESSAGE_POSITIVE for all messages. A normal message is a positive message. In other words, it corresponds to a row of data in the stream.
The other types of messages are not currently intended for use with adapters.
In general, when a "const *" is returned for data associated with an object (for example, a schema associated with a message), the validity of the returned pointer is limited to the lifetime of the pointer's owner (for example, the message). Attempts to de-reference the pointer after the owner no longer exists may result in a runtime exception.
Parameters:
msg_type: In almost all cases, this is C8_MESSAGE_POSITIVE. For a list of other message types, see the definition of C8_MESSAGE_TYPES in the file c8messages.h.
schema_ptr : A pointer to the schema that you want to define the structure of the message.
Returns: A pointer to the newly created message. When you are done using this message, destroy it by passing it to C8MessageDestroy() .
See also the function C8MessageCreateWithSize() below.
Parameters:
msg_type: In almost all cases, this is C8_MESSAGE_POSITIVE. For a list of other message types, see the definition of C8_MESSAGE_TYPES in the file c8messages.h.
schema_ptr: A pointer to the schema you want to define the structure of the message.
field_size: A user estimated size of the entire message.
To calculate the fields_size, sum up the sizes of all of the fields, where the size of each field is the number of bytes of data stored in the field rounded to the closest larger multiple of 4, plus 4 bytes. For example, if you have a value that requires 5 bytes, then the total size for that field is 8 + 4 (5 rounded up to 8, plus 4) - a total of 12 bytes.
Estimates that are greater than the actual resulting messages size will result in unused memory. Estimates that are too low will result in automatic adjustments upward to the correct message size. Adjustments upward in size may decrease performance.
Returns: A pointer to the newly created message. When you are done using this message, you must destroy it by passing it to C8MessageDestroy().
See also the function C8MessageCreate().
void C8MessageDestroy(C8Message *msg_ptr)
Purpose: Destroys the message pointed to by msg_ptr. All messages created by the user or received by the C8AdapterReceiveMessage() or C8AdapterReceiveMessageWait() call must be destroyed after it has been dispatched to the Sybase CEP Serveror else a memory leak will occur.
Parameters:
msg_ptr: A pointer to the message to be destroyed (de-callocated).
Returns: Nothing.
Messages sometimes arrive in "bundles". The beginning of a bundle is marked by a special start-of-bundle control message (for which C8MessageGetType() returns C8_MESSAGE_START_BUNDLE) and the end of a bundle is marked with a special end-of-bundle control message (for which C8MessageGetType() returns C8_MESSAGE_END_BUNDLE). If you need to handle bundled messages differently from individual messages, you can determinethe start and end of a bundle by recognizing these messages. If you don't need to deal with bundled messages differently from how you deal with individual messages, then you can simply ignore all messages for which C8MessageGetType() returns C8_MESSAGE_START_BUNDLE and C8_MESSAGE_END_BUNDLE.
Parameters:
Returns: The message type. For a list of the valid message types, see the declaration of C8_MESSAGE_TYPES in the file c8messages.h.
Parameters:
i_msg: A pointer to the message for which you want to know the ID.
Returns: The message ID.
const C8Schema *C8MessageGetSchema(const C8Message *msg_ptr)
Purpose: Given a message, return the associated schema. This is useful after C8AdapterReceiveMessage() or C8AdapterReceiveMessageWait() provides a message that you wish to process depending upon the schema.
Parameters:
msg_ptr: A pointer to the message for which you want to know the schema.
Returns: A pointer to the schema. Do not change the memory that the pointer points to, and do not C8Free() this pointer. The lifetime of the returned pointer is limited to the lifetime of the pointer's owner (in this case, the message).
Parameters:
Returns: The row timestamp of the message.
void C8MessageSetMessageTimestamp(C8Message* msg_ptr, C8Timestamp i_timestamp)
Purpose: Set the row timestamp of the message to i_timestamp. This is the row timestamp of the message and not the timestamp in any columns in the message.
Parameters:
msg_ptr: The message whose row timestamp you want to set.
i_timestamp: The timestamp that you want to set the row timestamp to.
Returns: ##########################
Parameters:
msg_ptr: A pointer to the message that contains the column.
col_ndx: The index number of the desired column within the message. Note that the index is 0-based, not 1-based, and thus valid values range from 0 to N-1 where N is the number of columns in the message.
o_res: This variable is set to C8_TRUE if the column is NULL, C8_FALSE otherwise.
Returns: C8_OK if success, C8_FAIL otherwise.
Parameters:
msg_ptr: A pointer to the message that contains the column you want to check.
i_fldnm: The name of the column you want to check.
o_res : A pointer to a boolean that is set to C8_TRUE if the column has NULL and C8_FALSE otherwise.
Returns: C8_OK if success, C8_FAIL otherwise.
Parameters:
msg_ptr: A pointer to the message containing the column that you want to set to NULL.
col_ndx: The index number of the desired column within the message. The index is 0-based, not 1-based, and thus valid values range from 0 to N-1 where N is the number of columns in the message.
Returns: C8_OK if success, C8_FAIL otherwise.
Parameters:
msg_ptr: A pointer to the message.
i_fldnm: The name of the field to set to NULL.
Returns: C8_OK on success, C8_FAIL otherwise.
Parameters:
i_msg: A pointer to a message.
i_ndx: Indicates which column you want to retrieve the value from. Column numbers start at 0, not 1.
o_res: A pointer to a location that can store a pointer to the string that is retrieved.
Returns: C8_OK on success, C8_FAIL otherwise. The string returned by this function must be freed by the user with the C8Free() function.
Parameters:
i_msg: The message from which you want to extract the data.
i_fldnm: The name of the field/column to get the data from.
o_res: A pointer to a string; the function will set this pointer to point to the string retrieved.
Returns: C8_OK on success, C8_FAIL otherwise. The string returned by this function must be freed by the user with the C8Free() function.
Prior to using this function on a column for the first time, ensure that the desired data type is indeed stored at col_ndx by calling C8SchemaGetColumnType(). Before retrieving each row's value, ensure that the field contains a value by calling C8MessageColumnIsNull().
Parameters:
msg_ptr: The message from which you want to extract the data.
col_ndx: Indicates which column to retrieve data from. Column numbers start from 0, not 1.
o_res: A pointer to a location that can hold the C8Int value retrieved by the function.
Returns: C8_OK on success, C8_FAIL otherwise.
Prior to using this function on a column for the first time, ensure that the desired data type is stored at col_ndx by calling C8SchemaGetColumnType(). Before retrieving each row's value, ensure that the field contains a value by calling C8MessageColumnIsNull().
Parameters:
msg_ptr: The message from which you want to extract the data.
col_ndx: Indicates which column to retrieve data from. Column numbers start from 0, not 1.
o_res: A pointer to a location that can hold the C8Long value retrieved by the function.
Returns: C8_OK on success, C8_FAIL otherwise.
Prior to using this function on a column for the first time, ensure that the desired data type is indeed stored at col_ndx by calling C8SchemaGetColumnType(). Before retrieving each row's value, ensure that the field contains a value by calling C8MessageColumnIsNull().
Parameters:
msg_ptr: The message from which you want to extract the data.
col_ndx: Indicates which column to retrieve data from. Column numbers start from 0, not 1.
o_res: A pointer to a location that can hold the C8Float value retrieved by the function.
Returns: C8_OK on success, C8_FAIL otherwise.
Prior to using this function on a column for the first time, ensure that the desired data type is indeed stored at col_ndx by calling C8SchemaGetColumnType(). Before retrieving each row's value, ensure that the field contains a value by calling C8MessageColumnIsNull().
Parameters:
msg_ptr: The message from which you want to extract the data.
col_ndx: Indicates which column to retrieve data from. Column numbers start from 0, not 1.
o_res: A pointer to a location that can hold the C8Bool value retrieved by the function.
Returns: C8_OK on success, C8_FAIL otherwise.
Prior to using this function on a column for the first time, ensure that the desired data type is indeed stored at col_ndx by calling C8SchemaGetColumnType(). Before retrieving each row's value, ensure that the field contains a value by calling C8MessageColumnIsNull().
Parameters:
msg_ptr: The message from which you want to extract the data.
col_ndx: Indicates which column to retrieve data from. Column numbers start from 0, not 1.
o_res: A pointer to a location that can hold the C8Timestamp value retrieved by the function.
Returns: C8_OK on success, C8_FAIL otherwise.
Prior to using this function on a column for the first time, ensure that the desired data type is indeed stored at col_ndx by calling C8SchemaGetColumnType(). Before retrieving each row's value, ensure that the field contains a value by calling C8MessageColumnIsNull().
Parameters:
msg_ptr: The message from which you want to extract the data.
col_ndx: Indicates which column to retrieve data from. Column numbers start from 0, not 1.
o_res: A pointer to a location that can hold the C8Interval value retrieved by the function.
Returns: C8_OK on success, C8_FAIL otherwise.
Prior to using this function on a column for the first time, ensure that the desired data type is indeed stored at col_ndx by calling C8SchemaGetColumnType(). Before retrieving each row's value, ensure that the field contains a value by calling C8MessageColumnIsNull() .
Parameters:
msg_ptr: The message from which you want to extract the data.
col_ndx: Indicates which column to retrieve data from. Column numbers start from 0, not 1.
o_res: A pointer to a location that can hold a pointer to the string (C8Char *) value retrieved by the function.
Returns: C8_OK on success, C8_FAIL otherwise.
Prior to using this function on a column for the first time, ensure that the desired data type is indeed stored at col_ndx by calling C8SchemaGetColumnType(). Before retrieving each row's value, ensure that the field contains a value by calling C8MessageColumnIsNull().
Parameters:
msg_ptr: The message from which you want to extract the data.
col_ndx: Indicates which column to retrieve data from. Column numbers start from 0, not 1.
o_res: A pointer to a location that can hold a pointer to the BLOB value retrieved by the function.
o_sz: The function stores the length of the blob in the location pointed to by o_sz.
Returns: C8_OK on success, C8_FAIL otherwise.
The retrieved value is a "raw" BLOB (as opposed to a hex string or a base64 string). For an explanation of raw vs. hex string vs. base64 string formats, see "Data Types and Subroutines for UDFs and In-Process Adapters".
Prior to using this function on a column for the first time, ensure that the desired data type is indeed stored at col_ndx by calling C8SchemaGetColumnType(). Before retrieving each row's value, ensure that the field contains a value by calling C8MessageColumnIsNull() .
Parameters:
msg_ptr: The message from which you want to extract the data.
col_ndx: Indicates which column to retrieve data from. Column numbers start from 0, not 1.
o_res: A pointer to a location that can hold a pointer to the BLOB value retrieved by the function.
Returns: C8_OK on success, C8_FAIL otherwise.
The returned value is in a "base64 string" format (as opposed to a hex string or a raw BLOB). For an explanation of raw vs. hex string vs. base64 string formats, see "Data Types and Subroutines for UDFs and In-Process Adapters".
Prior to using this function on a column for the first time, ensure that the desired data type is indeed stored at col_ndx by calling C8SchemaGetColumnType(). Before retrieving each row's value, ensure that the field contains a value by calling C8MessageColumnIsNull() .
Parameters:
msg_ptr: The message from which you want to extract the data.
col_ndx: Indicates which column to retrieve data from. Column numbers start from 0, not 1.
o_res: A pointer to a location that can hold a pointer to the string value retrieved by the function.
Returns: C8_OK on success, C8_FAIL otherwise.
Prior to using this function on a column for the first time, ensure that the desired data type is indeed stored at col_ndx by calling C8SchemaGetColumnType(). Before retrieving each row's value, ensure that the field contains a value by calling C8MessageColumnIsNull().
Parameters:
msg_ptr: The message from which you want to extract the data.
i_fldnm: Indicates which column to retrieve data from.
o_res: A pointer to a location that can hold the C8Int (integer) value retrieved by the function.
Returns: C8_OK on success, C8_FAIL otherwise.
Prior to using this function on a column for the first time, ensure that the desired data type is indeed stored at col_ndx by calling C8SchemaGetColumnType(). Before retrieving each row's value, ensure that the field contains a value by calling C8MessageColumnIsNull().
Parameters:
msg_ptr: The message from which you want to extract the data.
i_fldnm: Indicates which column to retrieve data from.
o_res: A pointer to a location that can hold the C8Long value retrieved by the function.
Returns: C8_OK on success, C8_FAIL otherwise.
Prior to using this function on a column for the first time, ensure that the desired data type is indeed stored at col_ndx by calling C8SchemaGetColumnType(). Before retrieving each row's value, ensure that the field contains a value by calling C8MessageColumnIsNull().
Parameters:
msg_ptr: The message from which you want to extract the data.
i_fldnm: Indicates which column to retrieve data from.
o_res: A pointer to a location that can hold the C8Float value retrieved by the function.
Returns: C8_OK on success, C8_FAIL otherwise.
Prior to using this function on a column for the first time, ensure that the desired data type is indeed stored at col_ndx by calling C8SchemaGetColumnType(). Before retrieving each row's value, ensure that the field contains a value by calling C8MessageColumnIsNull().
Parameters:
msg_ptr: The message from which you want to extract the data.
i_fldnm: Indicates which column to retrieve data from.
o_res: A pointer to a location that can hold the C8Bool value retrieved by the function.
Returns: C8_OK on success, C8_FAIL otherwise.
Prior to using this function on a column for the first time, ensure that the desired data type is indeed stored at col_ndx by calling C8SchemaGetColumnType(). Before retrieving each row's value, ensure that the field contains a value by calling C8MessageColumnIsNull().
Parameters:
msg_ptr: The message from which you want to extract the data.
i_fldnm: Indicates which column to retrieve data from.
o_res: A pointer to a location that can hold the C8Timestamp value retrieved by the function.
Returns: C8_OK on success, C8_FAIL otherwise.
Prior to using this function on a column for the first time, ensure that the desired data type is indeed stored at col_ndx by calling C8SchemaGetColumnType(). Before retrieving each row's value, ensure that the field contains a value by calling C8MessageColumnIsNull().
Parameters:
msg_ptr: The message from which you want to extract the data.
i_fldnm; Indicates which column to retrieve data from.
o_res: A pointer to a location that can hold the C8Interval value retrieved by the function.
Returns: C8_OK on success, C8_FAIL otherwise.
Prior to using this function on a column for the first time, ensure that the desired data type is indeed stored at col_ndx by calling C8SchemaGetColumnType(). Before retrieving each row's value, ensure that the field contains a value by calling C8MessageColumnIsNull().
Parameters:
msg_ptr: The message from which you want to extract the data.
i_fldnm: Indicates which column to retrieve data from.
o_res: A pointer to a location that can hold a pointer to the string (C8Char *) value retrieved by the function.
Returns: C8_OK on success, C8_FAIL otherwise.
Prior to using this function on a column for the first time, ensure that the desired data type is indeed stored at col_ndx by calling C8SchemaGetColumnType(). Before retrieving each row's value, ensure that the field contains a value by calling C8MessageColumnIsNull().
Parameters:
msg_ptr: The message from which you want to extract the data.
i_fldnm: Indicates which column to retrieve data from.
o_res: A pointer to a location that can hold a pointer to the BLOB value retrieved by the function.
o_sz: The function stores the length of the blob in the location pointed to by o_sz.
Returns: C8_OK on success, C8_FAIL otherwise.
The retrieved blob is a "raw" blob (as opposed to a hex string or a base64 string). For an explanation of raw vs. hex string vs. base64 string formats, see "Data Types and Subroutines for UDFs and In-Process Adapters".
Prior to using this function on a column for the first time, ensure that the desired data type is indeed stored at col_ndx by calling C8SchemaGetColumnType(). Before retrieving each row's value, ensure that the field contains a value by calling C8MessageColumnIsNull().
Parameters:
msg_ptr: The message from which you want to extract the data.
i_fldnm: Indicates which column to retrieve data from.
o_res: A pointer to a location that can hold a pointer to the string value retrieved by the function.
Returns: C8_OK on success, C8_FAIL otherwise.
Parameters:
msg_ptr: The message from which you want to extract the data.
col_ndx: Indicates which column to retrieve data from. Column numbers start from 0, not 1.
value: The value to store in the message.
Returns: C8_OK on success, C8_FAIL otherwise.
Parameters:
msg_ptr: The message from which you want to extract the data.
col_ndx: Indicates which column to retrieve data from. Column numbers start from 0, not 1.
value: The value to store in the message.
Returns: C8_OK on success, C8_FAIL otherwise.
Parameters:
msg_ptr: The message from which you want to extract the data.
col_ndx: Indicates which column to retrieve data from. Column numbers start from 0, not 1.
value: The value to store in the message.
Returns: C8_OK on success, C8_FAIL otherwise.
Parameters:
msg_ptr: The message from which you want to extract the data.
col_ndx: Indicates which column to retrieve data from. Column numbers start from 0, not 1.
value: The value to store in the message.
Returns: C8_OK on success, C8_FAIL otherwise.
Parameters:
msg_ptr: The message from which you want to extract the data.
col_ndx: Indicates which column to retrieve data from. Column numbers start from 0, not 1.
value: The value to store in the message.
Returns: C8_OK on success, C8_FAIL otherwise.
Parameters:
msg_ptr: The message from which you want to extract the data.
col_ndx: Indicates which column to retrieve data from. Column numbers start from 0, not 1.
value : The value to store in the message.
Returns: C8_OK on success, C8_FAIL otherwise.
If the pointer named "value" was obtained through C8Malloc(), the user must free the pointer (via C8Free()) after calling C8AdapterSendMessage() to prevent a memory leak. (The C8MessageColumnSetString() routine will make a copy of the value, so freeing that value does not cause the server to lose access to the information.)
Parameters:
msg_ptr: The message from which you want to extract the data.
col_ndx: Indicates which column to retrieve data from. Column numbers start from 0, not 1.
value: The value to store in the message.
Returns: C8_OK on success, C8_FAIL otherwise.
If the i_buf pointer was obtained through C8Malloc(), the user must free the pointer via C8Free() after C8AdapterSendMessage() to prevent a memory leak. (The C8MessageColumnSetBlob() routine will make a copy of the value, so freeing that value does not cause the server to lose access to the information.)
Note that the i_buf parameter should contain the original data value - do not convert the data to a string of hexadecimal values first. The function will do this for you. Note that since converting the data to a hexadecimal string will require 2N + 1 bytes (2 hex digits for each byte of the original data, plus a null byte as a string terminator), and since the longest allowable string is 4GB, the longest blob you can put in is 2GB - 1 bytes.
Parameters:
msg_ptr: The message from which you want to extract the data.
col_ndx: Indicates which column to retrieve data from. Column numbers start from 0, not 1.
i_buf: The BLOB value to store in the message. The value is a "raw" BLOB (as opposed to a hex string or a base64 string). For an explanation of raw vs. hex string vs. base64 string formats, see "Data Types and Subroutines for UDFs and In-Process Adapters".
i_sz: The number of bytes in the BLOB.
Returns: C8_OK on success, C8_FAIL otherwise.
If the i_base64_string pointer was obtained through C8Malloc(), the user must free the pointer via C8Free() after C8AdapterSendMessage() to prevent a memory leak. (The C8MessageColumnSetBlob() routine will make a copy of the value, so freeing that value does not cause the server to lose access to the information.)
Parameters:
msg_ptr: The message from which you want to extract the data.
col_ndx: Indicates which column to retrieve data from. Column numbers start from 0, not 1.
value: The BLOB value to store in the message. The value is a "raw" BLOB (as opposed to a hex string or a base64 string). For an explanation of raw vs. hex string vs. base64 string formats, see "Data Types and Subroutines for UDFs and In-Process Adapters".
Returns: C8_OK on success, C8_FAIL otherwise.
If the value pointer was obtained through C8Malloc(), the user must free the pointer (via C8Free()) after C8AdapterSendMessage() to prevent a memory leak. (The C8MessageColumnSetXmlFromString() routine will make a copy of the value, so freeing that value does not cause the server to lose access to the information.)
Parameters:
msg_ptr: The message from which you want to extract the data.
col_ndx: Indicates which column to retrieve data from. Column numbers start from 0, not 1.
value: The value to store in the message.
Returns: C8_OK on success, C8_FAIL otherwise.
Parameters:
msg_ptr: The message from which you want to extract the data.
col_ndx: Indicates which column to retrieve data from. Column numbers start from 0, not 1.
value: The value to store in the message.
Returns: C8_OK on success, C8_FAIL otherwise.
Parameters:
msg_ptr: The message from which you want to extract the data.
col_ndx: Indicates which column to retrieve data from. Column numbers start from 0, not 1.
value: The value to store in the message.
Returns: C8_OK on success, C8_FAIL otherwise.
Parameters:
msg_ptr: The message from which you want to extract the data.
col_ndx: Indicates which column to retrieve data from. Column numbers start from 0, not 1.
value: The value to store in the message.
Returns: C8_OK on success, C8_FAIL otherwise.
Parameters:
msg_ptr: The message from which you want to extract the data.
col_ndx: Indicates which column to retrieve data from. Column numbers start from 0, not 1.
value: The value to store in the message.
Returns: C8_OK on success, C8_FAIL otherwise.
Parameters:
msg_ptr: The message from which you want to extract the data.
col_ndx : Indicates which column to retrieve data from. Column numbers start from 0, not 1.
value: The value to store in the message.
Returns: C8_OK on success, C8_FAIL otherwise.
Parameters:
msg_ptr: The message from which you want to extract the data.
col_ndx: Indicates which column to retrieve data from. Column numbers start from 0, not 1.
value: The value to store in the message.
Returns: C8_OK on success, C8_FAIL otherwise.
If the value pointer was obtained through C8Malloc(), the user must free the pointer (via C8Free()) after C8AdapterSendMessage() to prevent a memory leak. (The C8MessageColumnSetStringByName() routine will make a copy of the value, so freeing that value does not cause the server to lose access to the information.)
Parameters:
msg_ptr: The message from which you want to extract the data.
col_ndx: Indicates which column to retrieve data from. Column numbers start from 0, not 1.
value: The value to store in the message.
Returns: C8_OK on success, C8_FAIL otherwise.
If the value pointer was obtained through C8Malloc(), the user must free the pointer (via C8Free()) after C8AdapterSendMessage() to prevent a memory leak. (The C8MessageColumnSetBlobByName() routine will make a copy of the value, so freeing that value does not cause the server to lose access to the information.)
Note that the i_buf parameter should contain the original data value -- do not convert the data to a string of hexadecimal values first -- the function will do that for you. Note that since converting the data to a hexadecimal string will require 2N + 1 bytes (2 hex digits for each byte of the original data, plus a null byte as a string terminator), and since the longest allowable string is 4GB, the longest blob you can put in is 2GB - 1 bytes.
Parameters:
msg_ptr: The message from which you want to extract the data.
col_ndx: Indicates which column to retrieve data from. Column numbers start from 0, not 1.
value - the value to store in the message. The value is a "raw" BLOB (as opposed to a hex string or a base64 string). For an explanation of raw vs. hex string vs. base64 string formats, see "Data Types and Subroutines for UDFs and In-Process Adapters".
Returns: C8_OK on success, C8_FAIL otherwise.
If the value pointer was obtained through C8Malloc(), the user must free the pointer via C8Free() after C8AdapterSendMessage() to prevent a memory leak. The C8MessageSetXmlFromStringByName() routine will make a copy of the value, so freeing that value does not cause the server to lose access to the information.
Parameters:
msg_ptr: The message from which you want to extract the data.
col_ndx: Indicates which column to retrieve data from. Column numbers start from 0, not 1.
value: The value to store in the message.
Returns: C8_OK on success, C8_FAIL otherwise.
Parameters:
msg_ptr: The message from which you want to extract the data.
col_ndx: Indicates which column to retrieve data from. Column numbers start from 0, not 1.
value: The value to store in the message.
Returns: C8_OK on success, C8_FAIL otherwise.
Parameters:
msg_ptr: The message from which you want to extract the data.
col_ndx: Indicates which column to retrieve data from. Column numbers start from 0, not 1.
value: The value to store in the message.
Returns: C8_OK on success, C8_FAIL otherwise.
Parameters:
batch: The batch you want a count of.
Returns: The number of messages in the batch.
Parameters:
batch: The batch from which you want to extract a message.
Returns: A pointer to a message or NULL if there are no messages in the batch. Use C8MessageDestroy to destroy each message when you are finished with it.
Parameters:
batch: The batch for which you want the ID.
Returns: A NULL-terminated string containing the batch ID.
Parameters:
batch: The batch you want to destroy.
Returns: Nothing.