Monday, February 6, 2017

How to release the Sequence lock in Mediator SOA 11g (Oracle Mediator Resequencer)

Message Sequencing is often a requirement in Enterprise application where you need to provide updates to the target application in some certain sequence. For example, courier status for an customer. It has to reach the customer in certain sequence like (Received, Shipped, Dispatched, Delivered, Confirmed, etc..). Even though the source application is providing the status in sequential manner, there is a possibility in integration layer that 3rd update may fail and the fourth one will be received by the customer. Once you reprocess the error instances the 3rd update will be received by the customer which will be of no sense (Received, Shipped, Delivered, Dispatched, Confirmed, etc..).
So we have to maintain the same sequence like it came from the source system.

So in SOA 11g, Oracle Mediator Resequencer which guarantees to maintain the desired message sequence in a reliable and robust manner.

You can implement the resequencer in Mediator by just selecting from the drop down box like below.


In the Picture, the sequence is applied on the account id. So for that account, whatever the update it came first will be delivered first. If some error happens in between, all the other updates to that account will be on hold.

Now, coming to the topic. How to release the lock if there is any, 
  1. Normally these mediator would have been implemented with fault policies such as Manual Recovery. In that case go to EM console, navigate to Faults and Rejected Messages and enable "Show only recoverable faults". Click on "Recovery" icon and retry the instance.


2. If you don't want to retry, you have an option of abort as well.

3. If nothing works, directly login to the Database with SOAINFRA schema. And use the below queries to  unlock the sequence.

select *  from mediator_group_status where status!=0;
update mediator_group_status set status=0 where status!=0;

No comments:

Post a Comment