Thursday 11 July 2013

Mediator FIFO Resequencer across groups

Mediator FIFO Resequencer across groups not processing the messages in the correct order.

Messages placed in the queue
   group 1 - 2 messages (msg1_1 msg1_2)
   group 2 - 4 messages (msg2_3 msg2_4 msg2_5 msg2_6)
   group 3 - 3 messages (msg3_7 msg3_8 msg3_9)

Process order: msg1_1 msg1_2 msg2_3 msg2_4 msg2_5 msg2_6 msg3_7 msg3_8 msg3_9

Expected behavior:
   process 1: msg1_1 msg2_3 msg3_7 (in any order)
   process 2: msg1_2 msg2_4 msg3_8 (in any order)
   process 3: msg2_5 msg3_9 (in any order)
   process 4: msg2_6

EXPLANATION:
-------------
Re-sequencer is not intended for sequencing across groups.
Mediator re-sequencer provides sequencing of messages within a group.

As clearly mentioned in section 22.2.2.1 Overview of the FIFO Re-sequencer
of link  :
http://docs.oracle.com/cd/E21764_01/integration.1111/e10224/med_resequencer.htm#CHDGJCDD

A FIFO re-sequencer would processes messages in sequence "for each group"
based on the arrival time.
The important thing to note in the above statement is - "for each group".
What this means is , a FIFO re-sequencer  would guarantee the sequential
processing of messages based on their arrival time "within each group"

A re-sequencer group is meant to provide "compartmentalization"
(i.e)
Each group would be processed as a separate entity (thread) and not depend on
other groups.
This is required, because , a failure in processing a group would not
interfere with the progression of messages in other groups.
The re-sequencer  guarantee  is that , the sequence would be maintained
within each group.

Consider the following example using FIFO:
12:00 AM , we en-queue 2 messages -     grp1-x , grp2-x
01:00 AM , we en-queue 2 messages -     grp1-y , grp2-y
02:00 AM , we en-queue 2 messages -     grp1-z , grp2-z

Now when the re-sequencer is started , the engine only guarantees that  the
messages within  each group will be sequenced in the order of arrival time.

So in this case , the guaranteed and expected de-queue  behavior is  that  ,
for each group the sequence will be maintained on basis of the arrival time
(i.e)
For group 1 - grp1-x(12:00),grp1-y(01:00),grp1-z(02:00)
and independently
For group 2 - grp2-x(12:00),grp2-y(01:00),grp1-z(02:00)

Again , since the re-sequencer is only meant for "sequencing  within group" ,
it's possible for the instances in EM to be something like
 -> grp1-x , grp2-x, grp2-y, grp2-z, grp1-y, grp1-z

As we can see grp1-x was processed by  lets say thread 1 , but before it
could process other messages another thread  (thread 2) completed the
sequence for grp2.
However ,as guaranteed ,  within each group the sequence has been maintained
as expected(x(at 12:00) followed by y(at 01:00) followed by z(at 02:00))

Re-sequencer is not meant for "re-sequencing across groups" .

No comments:

Post a Comment