Hi Simon,

I just created a Jira to keep track of this issue:
https://issues.apache.org/jira/browse/TUSCANY-2281

Besides using multiplicity="1..n", the interface Crawler is also
Conversational.
As mentioned in document "Java Common Annotations APIs", conversations
are created when
- a @Reference to a conversational service is injected
- a call is made to CompositeContext.getServiceReference() and then a
method of the service is called

So the only way of having multiple conversations in parallel on the same
Service from one client is to create multiple ServiceReferences. So if I
use a injected reference, then I can not have multiple conversations on
this reference. Or are there any other options to achieve this ?

A workaround for my project could be 
- to use "Factory" classes for each Crawler. So in my client I could use
a multiplicity reference to 1..n CrawlerFactories and in each
CrawlerFactory a single 1..1 reference to a Crawler service. Then in the
CrawlerFactory it would be possible to create ServiceReferences.
- to simply don't use SCAs conversation mechanism but implement my own
conversation handling.

Any suggestions ?

Bye,
Daniel


> Hi Daniel
> 
> Good question. The OASIS TC has proposed a solution to this issue (
> http://www.osoa.org/jira/browse/JAVA-9) but this isn't part 
> of the API we have implemented as we have taken the V1 API. 
> Can you raise a JIRA for this as I can't see one already and 
> at least in that way we can track it.
> 
> Is it possible for you to inject the references you need. You 
> can specify a reference with multiplicity as a collection, 
> for example, from itest/references
> 
> 
>     @Reference(name = "dServiceReferences")
>     public List<ServiceReference<DComponent>> dServiceReferences;
> 
> Which is populated by
> 
>     <component name="AComponent">
>          ...
>         <reference name="dServiceReferences" 
> target="DComponent DComponent1"
> />
>     </component>
> 
>     <component name="DComponent">
>         <implementation.java
> class="org.apache.tuscany.sca.itest.references.DComponentImpl" />
>     </component>
> 
>     <component name="DComponent1">
>         <implementation.java
> class="org.apache.tuscany.sca.itest.references.DComponentImpl" />
>     </component>
> 
> See the test for alternatives.
> 
> Regards
> 
> Simon
> 

Reply via email to