tags:

views:

186

answers:

1

Hello,

I am writing a Java code that sends messages to a JMS queue. I am doing this by using "QueueSender.send()".

The JMS queue itsels is sonicMQ but that's beside the point.

My problem is that sometimes the JMS queue is full and the thread that tries to send messages to the queue is starved.

Is there a way for me to know if the queue is full before sending the message? In this case I would prefer to print an exception to the log.

By the way, the JMS queue code itself is out of my reach. I can only change only the client code.

Thank you.

+1  A: 

The JMS queue itself is sonicMQ but that's beside the point.

Not really, this QueueMaxSize property is SonicMQ specific if I'm not wrong.

My problem is that sometimes the JMS queue is full and the thread that tries to send messages to the queue is starved.

My understanding of the Progress Sonic MQ Performance Tuning Guide 7.5 about the QueueMaxSize Property is that this is the normal (and wanted) behavior:

The total size of messages stored for a queue is the QueueMaxSize. When a Queue Sender tries to deliver a message to a queue that is at its maximum size, the sender will be flow controlled and the send of the message will be blocked until space is available.

Now, it would be maybe possible to get a Notification with a JMX client but I'm not sure this is feasible in your context (have a look at the Progress SonicMQ Administrative Programming Guide V7.5 if you want to dig this further or contact the support). But I'm really not sure this would work. Actually, I don't know if what you want to do is a good idea.

Pascal Thivent