« Return to Thread: JMS Queue Browsing Receiver

Re: JMS Queue Browsing Receiver

by Andrew Perepelytsya :: Rate this Message:

Reply to Author | View in Thread

I know there were issues with queue browsers in ActiveMQ before. Not that it wasn't fixed by v4 (I just don't know now). Before that it resulted in messages getting reordered randomly.

The problem will need some investigation. Could you also list the activemq config file. Generally, the easier you make to reproduce the scenario (test client, etc.) the higher the chances are you'll get feedback.

Andrew

On 8/25/06, 0x6e6562 <ben.hood@...> wrote:

I'm trying to create a JMS receiver that browses a queue in a controlling
thread using the QueueBrowser interface and then when it finds something,
for each message, it calls a worker thread to consume _a_ message with a non
blocking call.

The idea is that the browsing thread can peek at the queue in a
non-transactional session and if there is anything to consume, this can be
farmed out to separate threads, thereby minimising the time any worker
thread would idle when there is potentially work arrived in the queue but
not yet farmed out.

I've included the source of the receiver and my stripped down mule-config.

http://www.nabble.com/user-files/235766/BrowsingMessageReceiver.java
BrowsingMessageReceiver.java
http://www.nabble.com/user-files/235767/test-mule-config.xml
test-mule-config.xml

My problem is that the first enqueued message gets consumed correctly, but
the second enqueued message cannot get consumed.

When dequeueing the second message, the call to this consumer's
receiveNoWait() method returns null, although there _is_ a message in the
queue.

This fact is backed up by the JMX queue browser and the fact that you can
create a browser in the same session which allows you to peek at the
message.

The logic then sets the rollBackOnly flag and returns.

This then just cycles, because the controlling thread can still see the same
message on the queue and hence dispatches another worker thread.

I've tried this with the JMS and the XA transaction managers, to no avail.

The JMS provider is activemq 4.0.1, I haven't tried another provider yet.

I'm not too confident that my transaction handling is correct, as I don't
feel that I quite mastered the mule transaction management yet.

What I find strange is the fact that it works for the first message, but
then for no subsequent message.

Does anybody have ideas or things that I can try?
--
View this message in context: http://www.nabble.com/JMS-Queue-Browsing-Receiver-tf2166297.html#a5988823
Sent from the Mule - User forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list please visit:

     http://xircles.codehaus.org/manage_email


 « Return to Thread: JMS Queue Browsing Receiver