client window size and the JMS specification
andreas_back Jul 26, 2010 6:39 AMHello HornetQ-Team!
HornetQ is now used as the messaging server of our application that has been migrated from JBoss 3.2.4 and JBossMQ.
The application requires to set the client size window to 0 since the queue delivers jobs to a cluster of service units and the processing of such a job may take several hours. (JBoss Messaging's inability to set the prefechSize to 0 forced us to migrate to HornetQ.)
- Observation:
We have seen that the value of the parameter client-size-window influences the number messages the QueueBrowser reports.
- Test-Case:
A simple test class with a main method is attached.
- Motivation:
For administration purposes we have a (Pojo-) graphical tool to display the messages in the queue.
This tool uses just the JMS interface and this should have eased the migration from JBossMQ/JBoss Messaging to finally HornetQ.
But during our tests we have seen that only one or two messages have been found by the QueueBrower if client-size-window has been set to 0
while the queue must have contained many more messages. We have not seen such a dependency while using JBossMQ or JBoss Messaging.
This makes it impossible to use the QueueBrowser for an estimation of the current workload of the system.
- Workaround:
As a work around we used the following snipplet and set the consumerWindowSize to for example 2 000 000.
Queue queue = (Queue) initialContext.lookup(QUEUEZDSJOBQUEUE);
// Step 3. Perform a lookup on the Connection Factory
HornetQConnectionFactory cf = (HornetQConnectionFactory) initialContext.lookup("/ConnectionFactory");
cf.setConsumerWindowSize(consumerWindowSize());
Then the whole content of the queue is displayed. But now the code depends on HornetQ!
JMS specification:
The JMS specification version 1.1 April 12, 2001 states on page 78:
"The browse methods return a java.util.Enumeration that is used to scan the
queue’s messages. It may be an enumeration of the entire content of a queue,
or it may contain only the messages matching a message selector."
I would say that if no message arrives or expires when the scan is done then the result of the scanning
of the QueueBrowser shall reflect the status of the queue and the number of the messages in it.
Or to express it in another way. I cannot find a phrase like
"and the messages reported by the QueueBrowser may depend of the client-window-size" in this context of the specification ;-)
- Questions:
1. Does HornetQ violate the JMS specification if the number of messages reported by the QueueBrowser depends on the client-size-window?
2. Does HornetQ 2.1.1.GA allow to remove the usage of the HornetQConnectionFactory within the Java code?
Greeitings
Andreas