You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by Santiago Miguel Aranda Rojas <sa...@gmail.com> on 2009/07/09 16:45:59 UTC

Stateless components

I have two components in my SCA composite. First one has a wire with the
second one and It is published as web service. The second one has an vector
with data. It is a attribute of class. But I am losing this data because
when I invoked to web service a new instance of implementation is created. I
have read about Scope Stateless. I think this is my problem. How can I
maintain the same instance of implementation? I put @Scope("CONVERSATION")
in first and second component interfaces but it is not working. Any idea?
Thank very much

Re: Stateless components

Posted by Mike Edwards <mi...@gmail.com>.
Santiago,

I should have explained that @Scope is an implementation concept, not an interface concept, so 
@Scope annotations can only be used on the Java implementation class itself.


Yours,  Mike.

Santiago Miguel Aranda Rojas wrote:
> Thanks it works now. I had to put  @Scope("COMPOSITE")  in the 
> implementation file. It does not work if you put that in the interface file.
> 
> 2009/7/9 Mike Edwards <mike.edwards.inglenook@gmail.com 
> <ma...@gmail.com>>
> 
>     Santiago Miguel Aranda Rojas wrote:
> 
>         I have two components in my SCA composite. First one has a wire
>         with the second one and It is published as web service. The
>         second one has an vector with data. It is a attribute of class.
>         But I am losing this data because when I invoked to web service
>         a new instance of implementation is created. I have read about
>         Scope Stateless. I think this is my problem. How can I maintain
>         the same instance of implementation? I put
>         @Scope("CONVERSATION") in first and second component interfaces
>         but it is not working. Any idea?
>         Thank very much
> 
>     Santiago,
> 
>     Have you tried @Scope("COMPOSITE") ?
> 
>     This provides for a single instance of that component for all
>     invocations - ie state that is shared with all service invocations
>     on that component.
> 
> 
>     Yours,  Mike.
> 
> 


Re: Stateless components

Posted by Santiago Miguel Aranda Rojas <sa...@gmail.com>.
Thanks it works now. I had to put  @Scope("COMPOSITE")  in the
implementation file. It does not work if you put that in the interface file.

2009/7/9 Mike Edwards <mi...@gmail.com>

> Santiago Miguel Aranda Rojas wrote:
>
>> I have two components in my SCA composite. First one has a wire with the
>> second one and It is published as web service. The second one has an vector
>> with data. It is a attribute of class. But I am losing this data because
>> when I invoked to web service a new instance of implementation is created. I
>> have read about Scope Stateless. I think this is my problem. How can I
>> maintain the same instance of implementation? I put @Scope("CONVERSATION")
>> in first and second component interfaces but it is not working. Any idea?
>> Thank very much
>>
> Santiago,
>
> Have you tried @Scope("COMPOSITE") ?
>
> This provides for a single instance of that component for all invocations -
> ie state that is shared with all service invocations on that component.
>
>
> Yours,  Mike.
>

Re: Stateless components

Posted by Mike Edwards <mi...@gmail.com>.
Santiago Miguel Aranda Rojas wrote:
> I have two components in my SCA composite. First one has a wire with the 
> second one and It is published as web service. The second one has an 
> vector with data. It is a attribute of class. But I am losing this data 
> because when I invoked to web service a new instance of implementation 
> is created. I have read about Scope Stateless. I think this is my 
> problem. How can I maintain the same instance of implementation? I 
> put @Scope("CONVERSATION") in first and second component interfaces but 
> it is not working. Any idea? 
> 
> Thank very much
Santiago,

Have you tried @Scope("COMPOSITE") ?

This provides for a single instance of that component for all invocations - ie state that is shared 
with all service invocations on that component.


Yours,  Mike.