wood burning stoves 2.0*
The moose likes EJB and other Java EE Technologies and the fly likes Message lost or are not pulled by MDB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Message lost or are not pulled by MDB" Watch "Message lost or are not pulled by MDB" New topic
Author

Message lost or are not pulled by MDB

Raymond Ong
Ranch Hand

Joined: Jul 17, 2005
Posts: 46
Hi,

I have a pool of MDBs listening to a queue. I bombard the queue with 1000 messages concurrently (I made an app that creates 1000 threads that each sends a JMS message to the queue all at the same time approximately). The messages in the queue are persisted in a MySQL database.

As the onMessage() method of the MDB is triggered, I log that event to a file. I'm wondering why sometimes, I dont get 1000 logs which I expect and instead get logs less than 1000.

There are times when a number of messages stay stuck on the queue even if there are active MDBs listening. I can say the MDBs are listening because when I send a JMS message, it gets processed, yet the previously stuck messages remain stucked.

I suspect It has something to do with the memory. I tried to cut down the number of threads into half, so that's 500 concurrent messages sent to the queue and out of the 12 times I tested, only once did I not receive all 500. I lost about 48 messages, which neither was logged (pulled by MDB) nor exists in the queue.

Another reason I suspect the memory is because I stripped down my onMessage() method. I simply logged into a file. I haven't lost any message even If there were 1000 threads that sent the jms messages concurrently.

Here's my ejb-jar.xml


Here's my jboss.xml


My threads are set to send the message with the following settings:
priority=1
timeout=30000ms

My queue settings:
redelivery=3
redeliverywait=3000ms

I'm on a development pc:
P4 3.06GHz
512RAM
WinXP Home
using JBoss 4.0.2, MySQL 4.1

Is this a tweaking issue or a programming issue?
How do I tweak JBoss so JMS will behave as expected?
Any help is appreciated.

Thank you very much.
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Curious problem. What is your JMS provider? You mentioned the messages are backed by a database ... is that a "persistant queue" setting?

Are your queues and the database fully transactional? A committed put should be on queue and persisted for assured delivery. You mentioned in the 500 thread test that some messages were not picked up or left in queue which makes me wonder if the put worked. Make sure you commit somehow & check results.

Items left in queue sound buggy for sure. JMS should trigger onMessage for all messages unless something isn't really thread safe in there somwhere.


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Raymond Ong
Ranch Hand

Joined: Jul 17, 2005
Posts: 46
Originally posted by Stan James:
Curious problem. What is your JMS provider? You mentioned the messages are backed by a database ... is that a "persistant queue" setting?

Are your queues and the database fully transactional? A committed put should be on queue and persisted for assured delivery. You mentioned in the 500 thread test that some messages were not picked up or left in queue which makes me wonder if the put worked. Make sure you commit somehow & check results.

Items left in queue sound buggy for sure. JMS should trigger onMessage for all messages unless something isn't really thread safe in there somwhere.


I have set JBoss JMS to persist the messages to MySQL. The JMS message tables are InnoDB so it supports transactions. In the 12 times that I've created 500 threads to simultaneously sent JMS messages, only 1 failed. For the failed test around 50 messages of the total 500 were lost. It's pretty weird since the destination specified in the JMS message table is my original queue name, which means I messages are not being pulled by the MDBs which I am certain are alive. If the messages had been processed previously and the number of resending attempts has lapsed then the destination would have been my dead letter queue.

I will try to integrate JBoss with ActiveMQ and see how it goes.

Thanks
 
GeeCON Prague 2014
 
subject: Message lost or are not pulled by MDB