Contexts

The messaging APIs use processing Contexts for organizing communication between an application and a Solace router. 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 Java API, one thread is used for I/O and another for notification. For the Java RTO, C, and .NET APIs, 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.

Note:  Typically, a Context initializes and manages its own threads and file descriptors. However, the C API also allows client applications to drive the Context’s main loop with their own application-thread. For more information, refer to Selecting a Threading Model.

Context APIs

Language

API

Java

com.solacesystems.jcsmp.Context

Java RTO

com.solacesystems.solclientj.core.handle.ContextHandle

C

solClient_context_create(...)

solClient_opaqueContext_pt

.NET

SolaceSystems.Solclient.Messaging.ContextFactory

SolaceSystems.Solclient.Messaging.IContext

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

Overview of Core Concepts