Packagecom.kaazing.gateway.jms.client
Interfacepublic interface MessageConsumer
SubinterfacesGenericMessageConsumer, TopicSubscriber

A client uses a MessageConsumer object to receive messages from a destination. A MessageConsumer object is created by passing a Destination object to a message-consumer creation method supplied by a session.

MessageConsumer is the parent interface for all message consumers.

A message consumer can be created with a message selector. A message selector 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.

For asynchronous delivery, a client can register a MessageListener object with a message consumer. As messages arrive at the message consumer, it delivers them by calling the MessageListener's onMessage method.

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



Public Properties
 PropertyDefined by
  messageListener : MessageListener
Gets the message consumer's MessageListener.
MessageConsumer
  messageSelector : String
[read-only] Gets this message consumer's message selector expression.
MessageConsumer
Public Methods
 MethodDefined by
  
close(callback:Function = null):VoidFuture
Closes the message consumer.
MessageConsumer
  
receive(timeout:int = 0, callback:Function = null):MessageFuture
Not yet implemented. Receives the next message produced for this message consumer, that arrives within the specified timeout interval.
MessageConsumer
  
Not yet implemented. Receives the next message if one is immediately available.
MessageConsumer
Property detail
messageListenerproperty
messageListener:MessageListener  [read-write]

Gets the message consumer's MessageListener.

Implementation
    public function get messageListener():MessageListener
    public function set messageListener(value:MessageListener):void
messageSelectorproperty 
messageSelector:String  [read-only]

Gets this message consumer's message selector expression.

Implementation
    public function get messageSelector():String
Method detail
close()method
public function close(callback:Function = null):VoidFuture

Closes the message consumer.

Since a provider may allocate some resources on behalf of a MessageConsumer outside the immediate environemnt, clients should close them when they are not needed. Relying on garbage collection to eventually reclaim these resources may not be timely enough.

This call executes asynchronously (returns immediately), but the callback is not invoked until a receive or message listener in progress has completed. A message consumer receive callback will return null on the future when this message consumer is closed.

Parameters
callback:Function (default = null)

Returns
VoidFuture
receive()method 
public function receive(timeout:int = 0, callback:Function = null):MessageFuture

Not yet implemented. Receives the next message produced for this message consumer, that arrives within the specified timeout interval.

This call executes asynchronously (returns immediately), but the callback is not invoked until a message arrives, the timeout expires, or this message consumer is closed. Calling receive with no argument, or with a timeout of zero never expires, and the call waits indefinitely.

If this receive is done within a transaction, the consumer retains the message until the transaction commits.

Parameters
timeout:int (default = 0) — the timeout value (in milliseconds), defaults to no timeout (waits indefinitely).
 
callback:Function (default = null) — called when function has returned a value or thrown an exception

Returns
MessageFuture — the next message produced for this message consumer, or null if the timeout expires or this message consumer is concurrently closed
receiveNoWait()method 
public function receiveNoWait():Message

Not yet implemented. Receives the next message if one is immediately available.

Returns
Message — the next message produced for this message consumer, or null if one is not available