I have a composite with three components as given below:

<composite xmlns="http://www.osoa.org/xmlns/sca/1.0";
           targetNamespace="http://sample";
           name="HelloworldDelegate">

    <component name="HelloworldXComponent">
        <implementation.java class="sample.HelloworldImpl"/>
    </component>

    <component name="HelloworldDelegateComponent">
        <implementation.java class="sample.HelloworldDelegateImpl"/>
        <service name="HelloworldDelegate">
            <binding.ws uri="
http://localhost:8080/tuscany/HelloworldDelegate"/>
        </service>
        <reference name="helloworld" target="HelloworldXComponent"/>
        <property name="salutation">Monsieur</property>
    </component>

    <component name="HelloworldDelegateComponent2">
        <implementation.java class="sample.HelloworldDelegateImpl"/>
        <service name="HelloworldDelegate">
            <binding.ws uri="
http://localhost:8080/tuscany/HelloworldDelegate2"/>
        </service>
        <reference name="helloworld" target="HelloworldXComponent"/>
        <property name="salutation">Mr.</property>
    </component>
</composite>

HelloworldImpl provides a Helloworld service and requires a
HelloworldCallback callback service.
HelloworldDelegateImpl provides HelloworldDelegate service and
HelloworldCallback service. There are two components, namely
HelloworldDelegateComponent (with salutation "Monsieur") and
HelloworldDelegateComponent2 (with salutation "Mr.").  Both these components
invoke Helloworld service provided by HelloworldXComponent.
Both the implementations are COMPOSITE scoped.

When I use the HelloworldDelegate service from HelloworldDelegateComponent
the output I see in the console is the following:
    HelloworldDelegateComponent:
HelloworldDelegateImpl(sample.helloworlddelegatei...@28e2f1).sayHello: vamsi
    HelloworldXComponent:
HelloworldImpl(sample.helloworldi...@10076aa).sayHello:
vamsi
    HelloworldDelegateComponent:
HelloworldDelegateImpl(sample.helloworlddelegatei...@28e2f1).whoIs: vamsi

and the message got back is "Hello Monsieur vamsi".
------------------------------
When I use the HelloworldDelegate service from HelloworldDelegateComponent
the output I see in the console is the following:
    HelloworldDelegateComponent2:
HelloworldDelegateImpl(sample.helloworlddelegatei...@146e74b).sayHello:
vamsi
    HelloworldXComponent:
HelloworldImpl(sample.helloworldi...@10076aa).sayHello:
vamsi
    HelloworldDelegateComponent:
HelloworldDelegateImpl(sample.helloworlddelegatei...@28e2f1).whoIs: vamsi

and the message got back is "Hello Monsieur vamsi".  I was expecting "Hello
Mr. vamsi".

Notice that in the second case, the callback service is called from
HelloworldDelegateComponent instead of HelloworldDelegateComponent2. Is this
the expected behaviour?
-----------------

If I make HelloworldImpl as STATELESS scoped (which is the default), then I
am seeing that the callback service is invoked on the same component that is
invoking the Helloworld service. The following is the output:

HelloworldDelegateComponent:
HelloworldDelegateImpl(sample.helloworlddelegatei...@1c704a7).sayHello:
vamsi
HelloworldXComponent: HelloworldImpl(sample.helloworldi...@1af0f92).sayHello:
vamsi
HelloworldDelegateComponent:
HelloworldDelegateImpl(sample.helloworlddelegatei...@1c704a7).whoIs: vamsi
Hello Monsieur vamsi

HelloworldDelegateComponent2:
HelloworldDelegateImpl(sample.helloworlddelegatei...@61dec0).sayHello: vamsi
HelloworldXComponent: HelloworldImpl(sample.helloworldi...@4f3d72).sayHello:
vamsi
HelloworldDelegateComponent2:
HelloworldDelegateImpl(sample.helloworlddelegatei...@61dec0).whoIs: vamsi
Hello Mr. vamsi

What am I missing?

++Vamsi

Reply via email to