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".

- One Observable SCA component.
This component has a callback with the interface of the Observer
component as parameter, but no callback is injected in the component.

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, 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);
}

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?

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