You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@synapse.apache.org by Miyuru Wanninayaka <mi...@gmail.com> on 2012/10/03 13:03:01 UTC

Improving message injector task

Hi all,

Current synapse message injector task is not that user friendly.
Main reason is, it always injects messages to main sequence and user has to
add filter/switch to main sequence to route it to proper sequences. This
will become ugly with increasing number of tasks instances.

I'm thinking about improving it by adding support to define a target
sequence, so task will directly inject message to sequence.
Also I feel that mandating parameters message, soap action and To  is not
correct because user can define those using mediators later inside
sequences. In most use cases, users will put dummy values in task
configuration and overwrite later in a sequence.

        <task class="org.apache.synapse.startup.tasks.MessageInjector"
name="Task1">
            <property name="sequence" value="sequence1"/> <!--optional-->
            <property name="to"
value="http://localhost:9000/services/SimpleStockQuoteService"/>
<!--optional-->
            <property name="soapAction" value="urn:getQuote"/> <!--optional-->
            <property name="message">   <!--optional-->
                <m0:getQuote xmlns:m0="http://services.samples">
                    <m0:request>
                        <m0:symbol>IBM</m0:symbol>
                    </m0:request>
                </m0:getQuote>
            </property>
            <trigger interval="5"/>
        </task>


Change will not break existing task implementation but will enable it to
use in a flexible way.

WDYT?

-- 
Miyuru Wanninayaka
Senior Software Engineer - WSO2 Inc <http://wso2.com/>.

Re: Improving message injector task

Posted by Isuru Udana <is...@gmail.com>.
This is a very useful improvement.
If a sequence is not defined in the configuration, we can inject the
message to the main sequence.

On Wed, Oct 3, 2012 at 4:33 PM, Miyuru Wanninayaka <mi...@gmail.com>wrote:

> Hi all,
>
> Current synapse message injector task is not that user friendly.
> Main reason is, it always injects messages to main sequence and user has
> to add filter/switch to main sequence to route it to proper sequences. This
> will become ugly with increasing number of tasks instances.
>
> I'm thinking about improving it by adding support to define a target
> sequence, so task will directly inject message to sequence.
> Also I feel that mandating parameters message, soap action and To  is not
> correct because user can define those using mediators later inside
> sequences. In most use cases, users will put dummy values in task
> configuration and overwrite later in a sequence.
>
>         <task class="org.apache.synapse.startup.tasks.MessageInjector" name="Task1">
>             <property name="sequence" value="sequence1"/> <!--optional-->
>             <property name="to" value="http://localhost:9000/services/SimpleStockQuoteService"/> <!--optional-->
>             <property name="soapAction" value="urn:getQuote"/> <!--optional-->
>             <property name="message">   <!--optional-->
>                 <m0:getQuote xmlns:m0="http://services.samples">
>                     <m0:request>
>                         <m0:symbol>IBM</m0:symbol>
>                     </m0:request>
>                 </m0:getQuote>
>             </property>
>             <trigger interval="5"/>
>         </task>
>
>
> Change will not break existing task implementation but will enable it to
> use in a flexible way.
>
> WDYT?
>
> --
> Miyuru Wanninayaka
> Senior Software Engineer - WSO2 Inc <http://wso2.com/>.
>



-- 
*Isuru Udana*
*
*
*
Software Engineer; WSO2 Inc.; http://wso2.com

email: isudana@gmail.com
blog: http://mytecheye.blogspot.com/
twitter: http://twitter.com/isudana
*

Re: Improving message injector task

Posted by Sanjiva Weerawarana <sa...@opensource.lk>.
Miyuru how about creating some custom syntax for this purpose. IMO this is
not just a task ..

<message-injector[target-sequence=".."] trigger-interval="..">
  <to>..</to>
  <message> ..</message>
</message-injector>

(Details TBD.)

Sanjiva.

On Wed, Oct 3, 2012 at 4:33 PM, Miyuru Wanninayaka <mi...@gmail.com>wrote:

> Hi all,
>
> Current synapse message injector task is not that user friendly.
> Main reason is, it always injects messages to main sequence and user has
> to add filter/switch to main sequence to route it to proper sequences. This
> will become ugly with increasing number of tasks instances.
>
> I'm thinking about improving it by adding support to define a target
> sequence, so task will directly inject message to sequence.
> Also I feel that mandating parameters message, soap action and To  is not
> correct because user can define those using mediators later inside
> sequences. In most use cases, users will put dummy values in task
> configuration and overwrite later in a sequence.
>
>         <task class="org.apache.synapse.startup.tasks.MessageInjector" name="Task1">
>             <property name="sequence" value="sequence1"/> <!--optional-->
>             <property name="to" value="http://localhost:9000/services/SimpleStockQuoteService"/> <!--optional-->
>             <property name="soapAction" value="urn:getQuote"/> <!--optional-->
>             <property name="message">   <!--optional-->
>                 <m0:getQuote xmlns:m0="http://services.samples">
>                     <m0:request>
>                         <m0:symbol>IBM</m0:symbol>
>                     </m0:request>
>                 </m0:getQuote>
>             </property>
>             <trigger interval="5"/>
>         </task>
>
>
> Change will not break existing task implementation but will enable it to
> use in a flexible way.
>
> WDYT?
>
> --
> Miyuru Wanninayaka
> Senior Software Engineer - WSO2 Inc <http://wso2.com/>.
>



-- 
Sanjiva Weerawarana, Ph.D.
Founder, Director & Chief Scientist; Lanka Software Foundation;
http://www.opensource.lk/
Founder, Chairman & CEO; WSO2; http://wso2.com/
Founder & Director; Thinkcube Systems; http://www.thinkcube.com/
Member; Apache Software Foundation; http://www.apache.org/
Visiting Lecturer; University of Moratuwa; http://www.cse.mrt.ac.lk/

Blog: http://sanjiva.weerawarana.org/