C/C++ API Interface adapters

An overview of the behaviour of the C/C++ API interface adapters, including their functions and parameters.

As we mentioned earlier, a typical out-of-process adapter performs the following tasks:

  1. Acquiring an address (URI) that will uniquely identify a specific stream and telling the communication layer (provided by ) how to find that stream.

  2. Opening a connection to a tream.

  3. Reading (or writing) the desired data. Typically the read (or write) operation is in a loop.

  4. Closing the connection (if the adapter is not going to run indefinitely).

If the adapter is reading from the stream, then the adapter may need to wait until the next message arrives. There are three possible ways that the adapter can wait for the next message:

To poll, the adapter should call the C8SubscriberGetNextMessage() function and specify a maximum amount of time to wait. If a message does not arrive within the specified time, C8SubscriberGetNextMessage() will return control to the caller, which may do some work (or yield the processor) and then continue polling later by calling C8SubscriberGetNextMessage() again. Passing 0 as the wait time returns control immediately, without waiting.

To register a callback function, use the C8SubscriberSetCallback() function.

Below we describe all the functions in the API, including the functions that allow users to attach to streams, read or write streams, and detach from streams. (Acquiring a stream's address is done outside the API, and will be explained later.) The header file c8adapter.h describes the interface.

Remember to call C8ClientSDKInitialize() before calling any functions in an out-of-process adapter.