Daniel,

The default scope for implementation.osgi components is COMPOSITE - this
matches standard OSGi services where a single instance of the service is
added to the OSGi service registry and the same instance is returned by any
OSGi registry lookup. Other SCA scopes including CONVERSATION are supported
by implementation.osgi, but they require the OSGi service to be implemented
using service factories. If a service factory is registered for Gamma,
Tuscany will force a new instance of Gamma to be created
for every new conversation. There is an example of conversational services
using OSGi procedural services under itest/osgi-implementation. It is much
simpler with declarative services since you would just need to specify the
servicefactory flag for the service.

If you want to use a conversational service with Tuscany without registering
the service in the OSGi registry, you can use implementation.java. Since
your contribution is a bundle, OSGi will still be used to resolve your
classes, but the conversational service instances can be created directly
without going through OSGi service factories.

Hope this helps.


On 4/4/08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Hi all,
>
> We currently have a problem when using OSGi bundles
> (implementation.osgi) for SCA components instead of pure Java
> (implementation.java ).
>
> Again here is my "formidable" example using 3 Services Alpha, Beta and
> Gamma.
> Alpha.doSomething() calls Beta.getRef() which creates a reference to
> Gamma and returns it to Alpha.
> Alpha then executes Gamme.doSomethingElse().
> Gamma is marked wirh @Conversational and it's implementation with
> @Scope("CONVERSATION")
>
>
> If Alpha.doSomething() is executed twice (one after the other) the
> sample works well (without any error). ConversationIDs are created and
> reused. However, the OSGi implementation uses the same ConversationID in
> both calls of Alpha.doSomething(). In the pure Java implementation the
> ConversationIDs are different. Also, the Constructor for Gamma is not
> called in Beta.getRef() in the OSGi implementation.
>
>
> If I mark Alpha.doSomething() with @OneWay and Alpha.doSomething() is
> executed twice (now in "parallel" because of @OneWay) the sample still
> works for the pure Java implementation, but not for the OSGi
> implementation.
>
> The difference is, that in the OSGi implementation Beta.getRef(), which
> creates the ServiceReference to Gamma, the constructor of Gamma is NOT
> called. Thus, only one instance of Gamma exists and so only one
> ConversationId exists and is used two times (once for each call of
> Alpha.doSomething(). This leads to internal eerrors in
> Gamme.doSomethingElse().
>
> In the pure Java implementation the Constructor of Gamma is called
> twice, resulting in two instances and two seperate ConversationIDs.
>
> Is there something special we have to configure for OSGi services ? Do
> they support "Conversations" or do we have to implement conversation
> logic seperately ?
>
> Help is most welcome.
>
> Bye,
> Daniel
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
Thank you...

Regards,

Rajini

Reply via email to