PubSub+ API Concepts
In this section we'll provide you with an overview of PubSub+ messaging API fundamentals.
Contexts
The PubSub+ APIs use processing Contexts for organizing communication between an application and a PubSub+ event broker. Contexts act as containers in which zero or more 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. The life cycle of a context‑owned thread is bound to the life cycle of the Context.
A session can have zero or more:
-
flows
-
cache sessions
-
browsers
-
PubSub+ JCSMP API—One thread is used for I/O and another for notification.
-
PubSub+ Java RTO, C, and .NET APIs—A single thread is used for both I/O and for notification.
For more information, see Contexts.
Sessions
A session creates a single, client connection to an event broker for sending and receiving messages. Sessions also allow applications to add and remove subscriptions.
A client can:
-
bind to endpoints to attract matching guaranteed messages (queues or topic endpoints).
-
publish messages to destinations (topics or queues).
-
add and remove subscriptions that attract messages with matching topics (topics). Subscriptions are also assigned to topic endpoints and optionally queue endpoints.
For more information, see Sessions.
Flows
A consumer flow is an API object that allows applications to receive guaranteed messages from an endpoint, such as a Queue. It is created by a session.
For more information, see Guaranteed Message Flows.