Redelivery
processing is implemented by HTTP-BC and BPEL-SE, both of them use QOS library. Implementation is shared between the component and the QOS library.
Redelivery QOS library implemented as decorator (com.sun.jbi.common.qos.messaging.BaseMessagingChannel) on JBI Delivery channel and implements interface com.sun.jbi.common.qos.messaging.MessagingChannel an extension to JBI Delivery channel.
It keeps track on number of delivery attempts, and the error information associated with those invocations. It provides an API to query this information helps components making decision on retries. On completion of redelivery attempts component and QOS library share what is the due course for the Message Exchange (MEx). If user configured to "propagate error" or "suspend", component owns the responsibility. Otherwise namely "delete" or "error endpoint" QOS does the work and sends "Done" to component.
Component's ServiceUnitManager reads the QOS configuration from SU deployment descriptor (jbi.xml) using the utility from QOS module and sets on BaseMessagingChannel.
Can we reduce the burden for the components that are not transaction aware? It could be done by * Resetting MEx state to initial state. * QOS library creates a new MEx and copies input ( source - NormalizedMessage.getContent()), subject, attachment and properties.
Can we come up with exhaustive list of items to be copied from error MEx to new MEx for the second approach? After reviewing the API it does not look like an issue.
Does this approach work if the provisioning component changes the MEx input or properties before setting error. When the MEx is redelivered can the provisioning work with the redelivered MEx? The components reviewed are not changing the MEx they have received, certainly we do not know all the components.
If there no room for retry or MEx is associated with transaction it would return errored MEx to component.
Add new operation send(MessageExchangeBuilder mb) to com.sun.jbi.common.qos.messaging.MessagingChannel interface defined in QOS. BaseMessagingChannel implements it.
MessageExchangeBuilder interface is public interface MessageExchangeBuilder { public MessageExchange createMessageExchange(boolean failureOnFirstAttempt); }
QOS could provide implementation of this interface, it would have the logic to create MEx, set input, associate properties, type of MEx (InOnly/InOut), attachments, security/subject and transaction. Component would pass the object of this type to MessagingChannel.send as a parameter.
MessagingChannel .send delegates the call to DeliveryChannel.send with MEx object returned from callback method.
MessagingChannel.accept would delegate to DeliveryChannel.accept, if the MEx received is set to error and there is room for retry, it calls MessageExchangeBuilderObject.createMessageExchange(true). If this operation returns MessageExchange object, it proceeds with redelivery. If the callback method throws Exception, it would return errored MEx to component.
If no room for retry or MEx gets "Done", no change in current logic.
Component's ServiceUnitManager.init(), it could set SU name and SU path on BaseMessagingChannel. BaseMessagingChannel read the QOS configuration from descriptor instead of Component setting it.