SonicMQ API

progress.message.jclient
Interface MessageConsumer

All Superinterfaces:
MessageConsumer
All Known Subinterfaces:
MessageConsumer, QueueReceiver, QueueReceiver, TopicSubscriber

public interface MessageConsumer
extends MessageConsumer

A client uses a MessageConsumer for receiving messages that have been delivered to a destination.

Although is possible to have two Sessions with a MessageConsumer for the same queue, JMS does not define how messages are distributed between the MessageConsumers.

Version:
11-Dec-2003
Author:
Giovanni Boschi, May Hsu, Tim Bemis (migrated Prefetch methods up from QueueReceiver to MessageConsumer for JMS 1.1)
See Also:
MessageConsumer

Method Summary
 int getPrefetchCount()
          Get the prefetch count for the QueueReceiver.
 int getPrefetchThreshold()
          Get the prefetch threshold for the QueueReceiver.
 void setPrefetchCount(int count)
          Set the prefetch count for the QueueReceiver.
 void setPrefetchThreshold(int threshold)
          Set the prefetch threshold for the QueueReceiver.
 
Methods inherited from interface javax.jms.MessageConsumer
close, getMessageListener, getMessageSelector, receive, receive, receiveNoWait, setMessageListener
 

Method Detail

getPrefetchCount

int getPrefetchCount()
Get the prefetch count for the QueueReceiver. When this value is greater than one, the broker will be able to send multiple messages as part of a single QueueReceiver request.

Returns:
The number of messages to prefetch.
See Also:
setPrefetchCount(int)

getPrefetchThreshold

int getPrefetchThreshold()
Get the prefetch threshold for the QueueReceiver. When the number of messages waiting to be processed by the QueueReceiver falls to, or below, this number, a new batch of messages will be fetched.

Returns:
The threshold value for prefetching messages.
See Also:
setPrefetchThreshold(int)

setPrefetchCount

void setPrefetchCount(int count)
                      throws JMSException
Set the prefetch count for the QueueReceiver. When this value is greater than one, the broker will be able to send multiple messages as part of a single QueueReceiver request. This can improve performance.

Note that this is a Progress SonicMQ extention not found in the standard QueueReceiver interface.

Parameters:
count - The number of messages to prefetch.
Throws:
JMSException - if an invalid value is set.
See Also:
setPrefetchThreshold(int), getPrefetchCount()

setPrefetchThreshold

void setPrefetchThreshold(int threshold)
                          throws JMSException
Set the prefetch threshold for the QueueReceiver. When the number of messages waiting to be processed by the QueueReceiver falls to, or below, this number, a new batch of messages will be fetched. This number cannot exceed the prefetch count.

Setting this to a value greater than zero allows the QueueReceiver to always have messages available for processing locally without waiting for a broker interaction. This improves performance.

For example, a threshold value of two and a prefetch count of five will cause the QueueReceiver to fetch batches of five messages from the broker whenever the number of messages locally waiting for processing drops below two.

Note that this is a Progress SonicMQ extention not found in the standard QueueReceiver interface.

Parameters:
threshold - The threshold value for prefetching messages.
Throws:
JMSException - if an invalid value is set.
See Also:
setPrefetchCount(int), getPrefetchThreshold()

SonicMQ API

Copyright © 1999-2010 Progress Software Corporation. All Rights Reserved.
HTML formatted on 15-September-2010.