You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@synapse.apache.org by Sameera Jayasoma <sa...@gmail.com> on 2010/11/04 17:40:43 UTC

Behaviour of a Synapse Task which implements the ManagedLifeCycle interface

Hi devs,

Say I have a Synapse task which implements the ManagedLifeCycle interface.

Public class TestTask implements Task, ManagedLifeCyle {
  public void init(SynapseEnvironment se){
  }
  public void execute() {
  }
}

Synapse triggers the task as specified in the synapse.xml.  This init()
method is always invoked when the task is triggered. Is this the expected
behaviour?

Thanks
Sameera
-- 
Sameera Jayasoma
Technical Lead
WSO2 Inc.
Oxygenating the Web Service Platform.
http://wso2.org/

blog: http://tech.jayasoma.org

Re: Behaviour of a Synapse Task which implements the ManagedLifeCycle interface

Posted by Hiranya Jayathilaka <hi...@gmail.com>.
Hi Sameera,

On Thu, Nov 4, 2010 at 10:10 PM, Sameera Jayasoma
<sa...@gmail.com> wrote:
> Hi devs,
>
> Say I have a Synapse task which implements the ManagedLifeCycle interface.
>
> Public class TestTask implements Task, ManagedLifeCyle {
>   public void init(SynapseEnvironment se){
>   }
>   public void execute() {
>   }
> }
>
> Synapse triggers the task as specified in the synapse.xml.  This init()
> method is always invoked when the task is triggered. Is this the expected
> behaviour?

Yes, this is the expected behavior of the SimpleQuartzJob impl. This
enables user to have a little bit of extra pre-execution and
post-execution logic in the task implementation. In fact the Task
object is created new for each execution. The only thing that lives
through is the corresponding Startup object which holds the
description of the task.

According to the current impl, tasks are essentially stateless.
Meaning one execution does not depend on other executions.

Thanks,
Hiranya

>
> Thanks
> Sameera
> --
> Sameera Jayasoma
> Technical Lead
> WSO2 Inc.
> Oxygenating the Web Service Platform.
> http://wso2.org/
>
> blog: http://tech.jayasoma.org
>



-- 
Hiranya Jayathilaka
Senior Software Engineer;
WSO2 Inc.;  http://wso2.org
E-mail: hiranya@wso2.com;  Mobile: +94 77 633 3491
Blog: http://techfeast-hiranya.blogspot.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org
For additional commands, e-mail: dev-help@synapse.apache.org