Contexts
The PubSub+ Messaging APIs use processing contexts for organizing communication between an application and a PubSub+ 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 PubSub+ Java RTO API, PubSub+ C API, and PubSub+ .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 PubSub+ JavaScript API and PubSub+ 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 PubSub+ C API also allows client applications to drive the context’s main loop with their own application-thread. For more information, see PubSub+ C API Best Practices.
PubSub+ Messaging API | Call or Property |
---|---|
PubSub+ Java RTO API |
|
PubSub+ C API |
|
PubSub+ .NET API |
|
PubSub+ JavaScript API and PubSub+ Node.js API |
Not applicable |
The figure below shows the basic relationship between a context and its dependent processing components.
Overview of Core Concepts