22.11. .NET Class: SessionReceiver
The
SessionReceiver
class provides a convenient callback mechanism for messages received by all receivers on a given session.
using Org.Apache.Qpid.Messaging; using System; namespace Org.Apache.Qpid.Messaging.SessionReceiver { public interface ISessionReceiver { void SessionReceiver(Receiver receiver, Message message); } public class CallbackServer { public CallbackServer(Session session, ISessionReceiver callback); public void Close(); } }
To use this class a client program includes references to both
Org.Apache.Qpid.Messaging
and Org.Apache.Qpid.Messaging.SessionReceiver
. The calling program creates a function that implements the ISessionReceiver
interface. This function will be called whenever a message is received by the session. The callback process is started by creating a CallbackServer
and will continue to run until the client program calls the CallbackServer.Close function
.
A complete operating example of using the
SessionReceiver
callback is contained in cpp/bindings/qpid/dotnet/examples/csharp.map.callback.receiver
.
See Also: