You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by Da...@empolis.com on 2008/02/05 18:30:43 UTC
Question about Conversational Programming
Hi,
I'm currently evaluating Tuscany to be used in the new EILF eclipse
project. I have the following problem:
I have 3 components: Alpha, Beta and Gamma, where Gamma's Interface is
marked with @Conversational and @Scope("CONVERSATION").
I want Alpha to call a method on Beta that creates a conversation with
Gamma and returns a reference to Gamma. Then I want to reuse that
conversation to Gamma from Alpha.
Therefore I let Alpha call method Beta.getRef(). Inside this method, a
reference to Gamma is created via componentContext.getServiceReference()
and the conversation is initialized by calling method Gamma.init().
Beta.getRef() returns a CallableReference<Gamma>.
So far it works, but as soon as I call a method on that reference from
within Alpha, a new Conversation is initialized, the Conversation
created between Beta and Gamma is not reused.
So, instead of returning a CallableReference<Gamma> I called
Alpha.setRef() from within Beta.getRef() to set the reference to Gamma
in Alpha. Thereafter all calls from within Alpha on Gamma work and reuse
the Conversation created within Beta.getRef().
Why is it not possible to reuse an established Conversation using
Service References as return values but as parameters only?
If it's possible, what did I do wrong ?
Thanks,
Daniel
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org
Re: Question about Conversational Programming
Posted by Simon Laws <si...@googlemail.com>.
On Feb 5, 2008 5:30 PM, <Da...@empolis.com> wrote:
> Hi,
> I'm currently evaluating Tuscany to be used in the new EILF eclipse
> project. I have the following problem:
>
> I have 3 components: Alpha, Beta and Gamma, where Gamma's Interface is
> marked with @Conversational and @Scope("CONVERSATION").
> I want Alpha to call a method on Beta that creates a conversation with
> Gamma and returns a reference to Gamma. Then I want to reuse that
> conversation to Gamma from Alpha.
>
> Therefore I let Alpha call method Beta.getRef(). Inside this method, a
> reference to Gamma is created via componentContext.getServiceReference()
> and the conversation is initialized by calling method Gamma.init().
> Beta.getRef() returns a CallableReference<Gamma>.
> So far it works, but as soon as I call a method on that reference from
> within Alpha, a new Conversation is initialized, the Conversation
> created between Beta and Gamma is not reused.
>
> So, instead of returning a CallableReference<Gamma> I called
> Alpha.setRef() from within Beta.getRef() to set the reference to Gamma
> in Alpha. Thereafter all calls from within Alpha on Gamma work and reuse
> the Conversation created within Beta.getRef().
>
> Why is it not possible to reuse an established Conversation using
> Service References as return values but as parameters only?
> If it's possible, what did I do wrong ?
>
> Thanks,
> Daniel
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-user-help@ws.apache.org
>
> Hi Daniel, and welcome to Tuscany!
It sounds like you've found a bug. The way I read the SCA Java and
Annotations Spec your scenario should work. I'm specifically looking at line
483 which talks about conversations continuing when a service reference is
passed in as a parameter from another service. I would read this to include
return values though asI hadn't imagined the feature was restricted to just
input parameters.
I imagine the problem is that the conversion information is not being
serialized or deserialized correctly when the service reference is returned
compared to when it's passed as a parameter. Sounds a little odd.
If you could raise a JIRA (http://issues.apache.org/jira/browse/TUSCANY)
I'll take a look at it. Also if you have a test case to attach that would be
great as there would seem to be a gap in our testing.
Thanks
Simon