Handling faults in JMS and MQ JMS bindings

Faults can occur with JMS and MQ JMS bindings. Mechanisms are provided to handle these faults.

Before you begin

Why and when to perform this task

The argument that is expected to be passed to the JMSDataBinding and JMSObjectBinding depends on the interface operation and the Input, Output and fault types.

For faults, the outDataBindingType specified on the method binding is used. If none specified, the binding level dataBindingType is used for all serialization and deserialization.

If the fault type is simple, a string is set on the JMS DataBinding representing the fault message. In addition IsBusinessException is set to true.

If the fault type is a data object, then a data object is set on the JMS DataBinding which represents the fault message. This scenario requires the use of JMSDataBinding.

Messages containing faults are handled by the JMS data bindings. A Boolean header property IsBusinessException is intercepted by the data binding. If the value is true the data binding informs the runtime that the payload contains fault data.

If you are working with a custom data binding you need to take the following steps to handle faults correctly. Default implementations handle faults without user intervention.

Steps for this task

  1. For JMS exports, use the setBusinessException(boolean isBusinessException) method on the JMSDataBinding interface to indicate that data object or object specified on the Data Binding is a fault object and the message created by the binding should be constructed accordingly. The Data Binding is then responsible to specify the isBusinessException appropriately.
  2. For JMS imports use the isBusinessException() method on the JMSDataBinding interface to indicate whether the message contains a fault.

    The data binding gets the value of the header property indicating a fault defined in the payload. After the runtime passes the JMS Message to the data binding, it invokes isBusinessException() on the data binding. If returned value is false, the message is processed normally, otherwise, the ServiceBusinessException is returned to the caller. The data object or object produced by the binding is set on a ServiceBusinessException and it is returned to the caller.


Last updated: Wed 06 Dec 2006 07:08:08

(c) Copyright IBM Corporation 2005, 2006.
This information center is powered by Eclipse technology (http://www.eclipse.org)