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.
You can send the messages asynchronic to do so setAsynchronousDeliveryMode with Constants.ASYNC_DELIVERY_MODE_ENABLED in the ConnectionFactory
using spring
<bean id="connectionFactory" class="progress.message.jclient.QueueConnectionFactory">
...
<property name="asynchronousDeliveryMode">
<util:constant static-field= "progress.message.jclient.Constants.ASYNC_DELIVERY_MODE_ENABLED"/>
</property>
</bean>
see more details in progress.message.jclient Class ConnectionFactory