Class: MessageConsumer

MessageConsumer

Class that receives messages from a specific Destination. The consumer will deliver messages asynchronously to its MessageListener as soon as it is set.

new MessageConsumer()

This method is not meant to be used directly. Creates a MessageConsumer object that receives messages from a specific Destination.

Method Summary

close
Closes the consumer.
getMessageListener
Gets the message consumer's MessageListener.
getMessageSelector
Gets this message consumer's message selector expression.
receiveNoWait
Receives the next message if one is immediately available.
setMessageListener
Sets the consumer's MessageListener.

Method Detail

close()

Closes the consumer. Once closed, the consumer will not deliver any more messages.
Implementation note: underlying subscription is unsubscribed and deleted.

getMessageListener() → {MessageListener}

Gets the message consumer's MessageListener.
Returns:
Type
MessageListener

getMessageSelector() → {String}

Gets this message consumer's message selector expression.
Returns:
Type
String

receiveNoWait() → {Message}

Receives the next message if one is immediately available.
Returns:
Type
Message

setMessageListener(messageListener)

Sets the consumer's MessageListener. As soon as it is set, any message that is received will be forwarded to the listener in its MessageListener#onMessage event.
Parameters:
Name Type Description
messageListener MessageListener the message listener meant to receive messages from this consumer.