On Thu, Apr 24, 2008 at 4:02 AM, Ivan Dubrov <[EMAIL PROTECTED]> wrote:

> Seems like I still don't understand how to solve my problem. Actually, I'm
> trying to bind conversation-scoped component to the HTTP session and invoke
> it through the composite-scoped component (which I invoke via GWT-RPC). So,
> the calls are the following:
>
> AJAX UI -> (via GWT RPC) -> composite-scoped service (C1) ->
> conversation-scoped service (C2)
>
> Now I want that each call made from one session will go to one C2
> instance, and calls made from different session (with different session id)
> will go to different C2 instance. I've tried to extract session id in my
> GWT-RPC binding and put it as a "conversationID" in the "from" field of
> Message which I use to invoke the C1, but this does not work as expected.
> Every time I have different C2 instance.
>
> So, I want it to work the same way as referencing session-scoped bean from
> the singleton-scoped bean works in Spring framework.
>
>
> Mike Edwards wrote:
>
> > Ivan Dubrov wrote:
> >
> > > Hi,
> > >
> > > Is that possible to refer to the CONVERSATION-scoped component from
> > > COMPOSITE-scoped?
> > >
> > > What I want to achieve, is to make singleton component
> > > (COMPOSITE-scoped) retrieve some session data (which I want to model as a
> > > CONVERSATION-scoped component) during the request processing.
> > >
> > >
> > >  Ivan,
> >
> > Yes, this should work fine.
> >
> > I assume that your conversation scoped component has a conversational
> > interface of some kind?  If this is the case, then when the composite scoped
> > component calls it, a new conversation will be started with the comversation
> > scoped component and the composite scoped component can continue to use this
> > until the conversation session is explicitly ended (eg by calling an
> > @EndsConversation method.)
> >
> > Yours,  Mike.
> >
> >
>
> --
> WBR,
> Ivan S. Dubrov
>
>
>
Hi Ivan

You scenario generally sounds OK to me however I''m note clear about what
you do after this part.

"I've tried to extract session id in my GWT-RPC binding and put it as a
"conversationID" in the "from" field of Message which I use to invoke the
C1"

I would expect C1 to look something like...

@Scope("COMPOSITE")
public class C1Impl implements C1 {

    @Context
    protected ComponentContext componentContext;

    @Reference
    protected C2 c2Reference;

    public void doSomething(Message msg){
        ServiceReference<C2> serviceReference =
componentContext.getServiceReference(C2.class,

"c2Reference");
        serviceReference.setConversationID(msg.getFrom());

        C2 callableReference = serviceReference.getService();

        callableReference.doSomething();
    }
}

This may not be completely compilable as I just typed it in but the idea is
that the conversationId on a reference to C2 is being set manually to the
session id. It would be good if we had a test in Tuscany to try out this
scenario and make sure that it does work (all contributions welcome;-).

Hope that helps

Simon

Reply via email to