Threading When Receiving Messages

When receiving published messages, the context uses a processing thread to read messages off the socket, parse them, and then, depending on whether a synchronous or asynchronous mode is used, enqueue the messages for delivery or consumption, or perform customer notification and message dispatch.

Client applications can use one of the following modes to receive published messages:

  • Synchronous

    The Solace .NET API can only receive messages asynchronously.

Receiving Messages Asynchronously

A client application can use the Solace .NET API to receive messages in an asynchronous manner. That is, when messages are available, they are automatically sent ("pushed") to a message callback or message delegate interface from the API to the client application.

When receiving messages asynchronously, the context uses a processing thread for consumer notification and dispatching the queued messages to consumers; all callbacks from the API to the application, such as message receive callbacks, event callbacks, and timer callbacks, run from a context thread.

When a client application is using asynchronous transacted sessions, messages are dispatched from one or more transacted session dispatcher threads. Either a single transacted session dispatcher thread that is bound to the context (this is the default) or separate transacted session dispatcher threads that are that are bound to each transacted session can be used. For more information, see Using Local Transactions.

Contexts used by the Solace .NET API asynchronously receive messages. The Solace .NET API only uses one processing thread for the context. This thread reads messages off the socket, parses them, and then performs consumer notification and dispatches the messages to consuming applications.

The figure below shows the context thread that is used to receive messages asynchronously through the Solace .NET API.

Receiving Messages Asynchronously With the Solace .NET API

Receiving Messages Synchronously

The Solace .NET API can only receive messages asynchronously.