Hi

comments in line.

Simon

On Thu, Feb 11, 2010 at 12:55 PM, keinmensch <[email protected]> wrote:
> Hello!
> Further explorations of callbacks in Tuscany 2.0M4. I have the following
> scenario:
>
> - Two Observer SCA components.
> Each component has a reference to an Observable component with the
> wiredByImpl="true".

Why wiredByImpl? Is that important in this scenario?

>
> - One Observable SCA component.
> This component has a callback with the interface of the Observer

Is this what you mean here...

@Callback(Observer.class)

public interface Observable{

> component as parameter, but no callback is injected in the component.

How is the callback in the component implementation defined?

public class ObservableImpl implements Observable {

    @Callback
    protected Observer callback;

What's the scope of the component implementation?

>
> To register for notifications, an Observer calls register on an
> Observable, without any parameters.
> In the Observable, a callback service reference is retrieved like this:
> ServiceReference<ObserverService> theObserverRef =
> mRequestContext.getCallbackReference();
>
> This service reference is stored and later,

Are you storing in  a member variable? If so you need to be careful of
implementation scope.

> when a periodic task is run,
> an attempt is made to call all the Observer components that have
> registered with the Observable, like this:
> for (ServiceReference<ObserverService> theObserverRef : mObservers.values())
> {
>    theObserverRef.getService().notify("" + theCurrentTime);
> }

Looks ok.

>
> This fails - the call to notify never returns and there are no error
> messages or exceptions in the log.
> If I try to call the callback when it registers, there is an exception
> and a complaint about "No callback wire found".
> Is it possible to use callbacks in the way described above?

Should be possible. Sounds like there could be a bug. Are you able to
share you code or make a stripped down version that
we can run. If so please create a JIRA and we'll give it a go.

>
> Service Component Architecture SCA-J Common Annotations and APIs
> Specification, version 1.1, in section 7.2.4 says:
> "Because ServiceReference objects are serializable, they can be stored
> persistently and retrieved at
> a later time to make a callback invocation after the associated service
> request has completed."
>
> ...so I was lead to believe that my scenario would be possible.
> Best wishes,
>  Ivan
>
>

Reply via email to