Initializing and Monitoring the API

This section describes how to initialize the Solace C API and provides information for using logging and session statistics.

Initializing the API

To work with the Solace C API, it must first be initialized.

When the Solace C API is initialized, you can optionally set the initial log level filter for all log categories so that only logs at a specified level and more severe are emitted. (For more information on logging levels, see Configuring Logging.)

You can also set the global buffer sizes for the memory pools that are used to temporarily save messages in the application space. For more information, see Solace C API Best Practices.

Initializing the Solace C API

To initialize the Solace C API, use the function solClient_initialize(...).

Related Samples

For an example of how to initialize the Solace C API, see the DirectPubSub sample.

Cleanup

When the client application is finished using the Solace C API, it should perform a global clean-up, which automatically frees all allocated resources, including those allocated for contexts and sessions that have been previously created but are not destroyed.

Cleanup Function

To perform global cleanup when finished with the Solace C API, use the function solClient_cleanup().

Contexts and sessions should always be destroyed before a cleanup is performed. If solClient_cleanup() is called while sessions are connected, any messages buffered for transmission are discarded and not sent. Note that invocations of solClient_initialize() and solClient_cleanup() are reference counted. For example, if solClient_initialize() is called twice, solClient_cleanup() must be called twice to properly free the resources.

Related Samples

For an example of how to perform a global cleanup, see the DirectPubSub sample.