Contexts

The Solace Messaging APIs use 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 Java RTO API, Solace C API, and Solace .NET 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. The Solace JavaScript API and Solace Node.js API APIs are single threaded and have a single global context that is not exposed.

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.

Context APIs

Solace Messaging API Call or Property

Solace Java RTO API

com.solacesystems.solclientj.core.handle.ContextHandle

Solace C API

solClient_context_create(...)

solClient_opaqueContext_pt

Solace .NET API

SolaceSystems.Solclient.Messaging.ContextFactory

SolaceSystems.Solclient.Messaging.IContext

Solace JavaScript API and Solace Node.js API

Not applicable

The figure below shows the basic relationship between a context and its dependent processing components.

Overview of Core Concepts