Collapse All Expand All

.NET Framework Class Library
Members See Also

[TIBCO.EMS .NET client library 5.1 documentation]

A client uses a MessageConsumer object to receive messages from a destination.

Namespace: TIBCO.EMS
Assembly: TIBCO.EMS (in TIBCO.EMS.dll)

# Syntax

    public class MessageConsumer : DPQMember

    Public Class MessageConsumer _
    	Inherits DPQMember

    public ref class MessageConsumer : public DPQMember

# Remarks

MessageConsumer is the parent interface for all message consumers.

A MessageConsumer object is created by passing a Destination object to a message-consumer creation method supplied by a session. A message consumer can be created with a message selector that allows the client to restrict the messages delivered to the message consumer to those that match the selector.

A client may either synchronously receive a message consumer's messages or have the consumer asynchronously deliver them as they arrive.

For synchronous receipt, a client can request the next message from a message consumer using one of its receive methods. There are several variations of receive that allow a client to poll or wait for the next message.

Consumers can receive messages asynchronously in either of two idioms. Programmers may select either idiom—but not both (which would cause duplicate message processing, with undefined behavior).

- MessageHandler - see EMSMessageHandler for more information. The client library raises an event when a message arrives at the destination. The program implements a handler delegate to processes it asynchronously, and registers the delegate here.
- MessageListener - see IMessageListener for more information. A client can register a MessageListener object with a message consumer. When a message arrives, the client library calls this listener’s onMessage method with the message as its argument. The program implements the message listener interface, and registers a message listener object by setting this property. The MessageListener mimics the way in which JMS provides similar functionality in a Java programming idiom

A message selector restricts the set of messages that the consumer receives to those that match the selector. Programs can set this property only when creating the consumer object; see Session.CreateConsumer.

It is a client programming error for a MessageListener to throw an exception.

# Inheritance Hierarchy

System..::.Object
TIBCO.EMS..::.DPQMember
TIBCO.EMS..::.MessageConsumer
TIBCO.EMS..::.QueueReceiver
TIBCO.EMS..::.TopicSubscriber

# See Also

MessageConsumer Members
TIBCO.EMS Namespace