Contexts
The Solace C API uses processing contexts for organizing communication between an application and a Solace event broker. Contexts act as containers in which sessions are created and session-related events can be handled.
A context encapsulates threads that drive network I/O and message delivery notification for the sessions and session components associated with that context. For the Solace C API, a single thread is used for both I/O and for notification. The life cycle of a context‑owned thread is bound to the life cycle of the context.
Typically, a context initializes and manages its own threads and file descriptors. However, the Solace C API also allows client applications to drive the context’s main loop with their own application-thread. For more information, see Solace C API Best Practices.
To work with contexts in the Solace C API, use the following functions:
solClient_context_create(...)solClient_opaqueContext_pt
The figure below shows the basic relationship between a context and its dependent processing components.
Overview of Core Concepts