Friday, December 21, 2012

JMS Message Retry in BPEL

Reliability is one of the key features in integration scenario. Customer never wants to hear that application failed to process the message and it is even worst when application lost the message.

 Consider a typical scenario where client posts a message to queue and BPEL is consuming the message from the queue. If any failure happens in the BPEL the message should be rolled back to the original JMS Queue and should retry after some delay. If the retry limit is reached then the message should be moved to the ErrorQueue. Later the failed messages can be retrieved from the error queue and can be reprocessed. Ultimately this helps to preserve the customer data and shows the applications reliability.

Lets create a queue, error queue and connection factory as shown below


 For the MyDistributedQueue configure the error queue as follows


 Goto Deployments->jmsAdapter->configuration->OutboundConnectionPool

 Create a new connection pool  and specifying the connection factory which we created in the first step


Set the acknowledgement mode as client_ack

 

Create a BPEL process with a JMSAdapter for consuming the message from the queue




Also its important to set the oneWayDeliveryPolicy to sync in the composite.xml


Now in the BPEL process add an throw activity with rollback exception/system exception





Deploy the process and post a message in the MyDistributedQueue

Set the ReDeliveryLimit to 5 while posting the message






Now watch the emconsole , we can see 6 instances of the process getting created as the redelivery limit value was set as 5



After 5 retries the message will be redirected to the ErrorQueue.

Now if we watch the MyDistributeQueue, the message wont be available there.


Now check the error queue, we can see the message over there


Select the queue and go to show message. we can see the original message


No comments:

Post a Comment