High Quality JMS Messaging.

Advanced Exception Handling

The JMS specification defines the exception javax.jms.JMSException as the base class for JMS related exceptions. These exceptions are sufficient in most cases. A JMS client that reduces its exception handling (acting on exceptions) on these classes will be portable between JMS vendors.

However, there are cases where a JMS client must react on provider specific behavior such as connection lost or resource limits. This is not covered by the JMS specification. The only "spot" within the javax.jms.JMSException is an error-code field which could contain a provider specific error code. If a client depends on this field, it becomes less portable.

SwiftMQ does not fill the error-code field of javax.jms.JMSException, however, SwiftMQ 5.2.0 introduces advanced exception handling in form of exception classes which extend javax.jms.JMSException and so provide a clean way for clients to catch it and react in a proper way. These exceptions can be thrown by the relevant methods of the JMS API which throw javax.jms.JMSException.

List of SwiftMQ Exceptions

The following table provides a list of all exceptions which might be delivered to a JMS client. All exceptions extend javax.jms.JMSException.

Exception Meaning
com.swiftmq.jms.ConnectionLostException The connection to the router was disconnected. This exception will also be delivered to a registered javax.jms.ExceptionListener.
com.swiftmq.jms.RequestTimeoutException A SMQP request timed out, a reply wasn't received within the time configured by system property "swiftmq.request.timeout". Can be thrown from any method that interacts with the router.
com.swiftmq.swiftlet.auth.AuthenticationException There was a problem with authentication, e.g. user unknow, password wrong. Since this exception extends javax.jms.JMSSecurityException, it is usually not necessary to catch it. Thrown from the connection factory's methods to create a connection.
com.swiftmq.swiftlet.auth.ResourceLimitException The client tried to exceed a predefined resource limit (assigned resource limit group of the particular user). Thrown from the relevant connection/session methods to create producer, consumer, temporary queues/topics.
com.swiftmq.swiftlet.queue.QueueLimitException The maximum number of messages defined for this queue has been reached. Thrown from send or commit methods of a message producer.
com.swiftmq.swiftlet.queue.QueueException A generic queue exception. Should only be thrown on serious issues such as disk full etc.