ESB task sequence selection

View: New views
3 Messages — Rating Filter:   Alert me  

ESB task sequence selection

by Harm Verhagen-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I've a question regarding esb tasks.

I found an excellent example how to create a Task in [1]
Question: how can one configure in which sequence a Task injected messages is processed ?

Regards,
Harm

[1] http://wso2.org/library/2900

_______________________________________________
Esb-java-user mailing list
Esb-java-user@...
https://wso2.org/cgi-bin/mailman/listinfo/esb-java-user

Re: ESB task sequence selection

by Ruwan Linton-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Harm Verhagen wrote:
> I've a question regarding esb tasks.
>
> I found an excellent example how to create a Task in [1]
> Question: how can one configure in which sequence a Task injected
> messages is processed ?
Hi Harm,

This article is about writing your own custom task. You could write your
own custom task to implement this sort of an injection. If you use the
MessageInjectorTask shipped by default, it just injects the messages
into the main sequence.

You could write a new task with a String parameter specifying the
sequence to which the message needs to be injected and write the getter
and setters properly so that you can configure the injection sequence at
runtime. If you are looking for the code to do this, you could use the
following method in the Task#execute() method, of course you need to
store the SynapseEnvironment inside the task implementation at the
initialization.

SynapseEnvironment#injectAsync(MessageContext smc, SequenceMediator seq)

You could use the SynapseConfiguration#getSequence(String key) method to
retrieve a sequence to be passed into the above method.

Is this what you wanted to know?

Thanks,
Ruwan

>
> Regards,
> Harm
>
> [1] http://wso2.org/library/2900
> ------------------------------------------------------------------------
>
> _______________________________________________
> Esb-java-user mailing list
> Esb-java-user@...
> https://wso2.org/cgi-bin/mailman/listinfo/esb-java-user
>  


--
Ruwan Linton
Senior Software Engineer & Product Manager; WSO2 ESB; http://wso2.org/esb
WSO2 Inc.; http://wso2.org
email: ruwan@...; cell: +94 77 341 3097
blog: http://ruwansblog.blogspot.com


_______________________________________________
Esb-java-user mailing list
Esb-java-user@...
https://wso2.org/cgi-bin/mailman/listinfo/esb-java-user

Re: ESB task sequence selection

by Harm Verhagen-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Right.
This did the trick.
SequenceMediator seq = (SequenceMediator) mc.getSequence(sequence);
 if (seq == null)
 {
                  log.error("invalid sequence: "+ sequence);
                  return;
 }
       
synapseEnvironment.injectAsync(mc, seq);


Regards,
Harm

On Mon, Apr 6, 2009 at 1:24 PM, Ruwan Linton <ruwan@...> wrote:
Harm Verhagen wrote:
> I've a question regarding esb tasks.
>
> I found an excellent example how to create a Task in [1]
> Question: how can one configure in which sequence a Task injected
> messages is processed ?
Hi Harm,

This article is about writing your own custom task. You could write your
own custom task to implement this sort of an injection. If you use the
MessageInjectorTask shipped by default, it just injects the messages
into the main sequence.

You could write a new task with a String parameter specifying the
sequence to which the message needs to be injected and write the getter
and setters properly so that you can configure the injection sequence at
runtime. If you are looking for the code to do this, you could use the
following method in the Task#execute() method, of course you need to
store the SynapseEnvironment inside the task implementation at the
initialization.

SynapseEnvironment#injectAsync(MessageContext smc, SequenceMediator seq)

You could use the SynapseConfiguration#getSequence(String key) method to
retrieve a sequence to be passed into the above method.

Is this what you wanted to know?

Thanks,
Ruwan
>
> Regards,
> Harm
>
> [1] http://wso2.org/library/2900
> ------------------------------------------------------------------------
>
> _______________________________________________
> Esb-java-user mailing list
> Esb-java-user@...
> https://wso2.org/cgi-bin/mailman/listinfo/esb-java-user
>


--
Ruwan Linton
Senior Software Engineer & Product Manager; WSO2 ESB; http://wso2.org/esb
WSO2
Inc.; http://wso2.org
email: ruwan@...; cell: +94 77 341 3097
blog: http://ruwansblog.blogspot.com


_______________________________________________
Esb-java-user mailing list
Esb-java-user@...
https://wso2.org/cgi-bin/mailman/listinfo/esb-java-user


_______________________________________________
Esb-java-user mailing list
Esb-java-user@...
https://wso2.org/cgi-bin/mailman/listinfo/esb-java-user