synapse-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Buddhima Wijeweera <buddhimawijewe...@gmail.com>
Subject Re: Implementing Resequencer EAI Pattern for Synapse
Date Sat, 14 Jul 2012 08:42:51 GMT
Hi All,

Thanks Charith for your comments and great suggestions.

Let me explain the design of the resequencing processor. The configuration
is done as follows:

<messageProcessor

class="org.apache.synapse.message.processors.resequence.ResequencingProcessor"
            name="ResequencingProcessor" messageStore="MyStore">

        <parameter name="interval">15000</parameter>

<parameter name="seqNo" xmlns:bank="http://bank.resequence.synapse.org"
expression="//bank:display/bank:seqNo"/>

<parameter name="sequence">next_seq</parameter>

</messageProcessor>

 - Initially you need to mention the class of the resequencer and the
message store which you are going to plug this resequencer.
 - Then from *interval* parameter you can mention the time period which the
processor should be re-activated. (The time period to re-check for the
required message)
 - *seqNo* parameter is to specify the Xpath to extract the sequence number
from the messages in the store.
   This special parameter has no  value but only an expression with
required namespaces.
 - *sequence* parameter says the next sequence the message should be
forwarded to.

*Logic behind the Resequencer*
Current logic behind the Resequencer is very simple. Processor is capable
of storing the next sequence number of the message to send. Processor scans
through the message store (given in configuration) at the given time
periods (interval parameter).
If the processor found the message that should be send next, it will send
that message to the sequence (given in sequence parameter) and increase the
seq.no-to-send by one. And again it scans the store until the
next seq.no-to-send is available at store.
If no message contains seq.no-to-send or the store is empty, then processor
waits until next time period-to-active occurs.
I'll also add this as a new feature to JIRA with in next few days.

So I would like to hear your suggestions and comments for further
improvement of this new feature.

Thank you !



On Sat, Jul 14, 2012 at 8:38 AM, Charith Wickramarachchi <
charith.dhanushka@gmail.com> wrote:

>
>
> On Fri, Jul 13, 2012 at 11:30 PM, Buddhima Wijeweera <
> buddhimawijeweera@gmail.com> wrote:
>
>> Hi all,
>>
>> I'm interested in contributing to the Synapse project. As my initial step
>> I've implemented the Resequencer EAI pattern [0] for Synapse.
>>
>>
> Hi Buddhima,
>
> Welcome to Apache Synapse project. :) And Having an Re sequencer support
> in synapse will be a  good contribution.
>
>
>
>> *Importance of a Resequencer*
>> As messages passing through Synapse they'll mediate through various
>> paths. So the order of the receiving messages may differ from sending
>> order. For some occasions this order matters. For those situations
>> Resequencer is the solution.
>>
>> *Implementation*
>> My implementation of Resequencer is based on message processor concept.
>> This processor can be plugged in to any kind of message store already
>> exists. So processor goes through those messages and sends messages out to
>> another sequence. So such a system has the flexibility of plugging in to
>> various situations. Specifying the sequencer number of the message is
>> configurable.
>>
>
>
> You can provide  mode details about the implementation. ex : how do you
> determine the sequence of the messages. How do you oder etc..
>
> The reason behind Idea of ordering messages and sending it to a sequence
> instead of sending it to a Service directly is that gives us more
> flexibility.
>
> ex ;
>
> Requirement may be to execute a DB Stored proc from a sequence in a
> ordered way.
>
> And if they way to send it to an endpoint This processor will be able to
> combined with Message Forwarding Processor to achieve reliable in order
> delivery between synapse and a service endpoint.
>
>>
>> *Further Details*
>> For the new implementation I had to change the implementation of
>> MessageProcessorFactory for giving ability to read parameters with
>> expressions.
>>
>
> This will be a good improvement for Message Store Factory too.
>
>
>> Then message processor reads the messages in a given store time to time
>> and send them to another sequence in an order.
>>
>> So far I have almost completed my implementation of this according to the
>> details mentioned and I'm willing to hear your opinions on this.
>>
>> *References*
>> [0] http://www.eaipatterns.com/Resequencer.html
>>
>>
>
>
>
> If you are willing to contribute. You can create Jiras in [1] and provide
> the patches. I'll be more than happy to review them with you and work with
> you to get them in to synapse.
>
> [1]https://issues.apache.org/jira/browse/SYNAPSE
>
> cheers,
> Charith
>
>
>> Thank you!
>> --
>> Buddhima Wijeweera,
>> Undergraduate,
>> Department Of Computer Science and Engineering,
>> University Of Moratuwa,
>> Sri Lanka.
>>
>>
>
>
> --
> Charith Dhanushka Wickramarachchi
> http://charithwiki.blogspot.com/
>
>


-- 
Buddhima Wijeweera,
Undergraduate,
Department Of Computer Science and Engineering,
University Of Moratuwa,
Sri Lanka.

Mime
View raw message