2007/11/27, Simon Nash <[EMAIL PROTECTED]>:
> This should work.  I am trying to understand the code example you
> gave.  In the code snippet you have a call to setCallback() that
> passes a ServiceReference<WorkpoolService> as the callback for a
> service of type WorkpoolService.  However, your sample service is
> of type AComponent and its callback service is of type
> AComponentCallback.  Somewhere you need to call setCallback() on
> a service reference of type AComponent, passing a callback service
> reference of type AComponentCallback.  Is there any code that
> does this?
Let me explain, the example was a proof of concept.
Actually in my code I have a component of name
WorkerComponentdc2c3b13d2aaa45d33c779af064c447f460d89f3, which is
dynamically generated, which it has no reference to other components.
Its definition is given by a template:
private StringTemplate t = new StringTemplate("<component
xmlns=\"http://www.osoa.org/xmlns/sca/1.0\";
name=\"$componentName$\">\n" +
                        "<implementation.java class=\"$className$\"/>"+
                        "<property 
name=\"workerName\">$componentName$</property>"+
                        "</component>");
I process it with my own component processor and then i add it to the
composite.(replacing $name$, with appropriate values)

This is my worker.This worker implements an interface:

@Remotable
@Callback(WorkerServiceCallback.class)
@DataBinding("org.apache.tuscany.sca.databinding.job.Job")
public interface WorkerService<T,E> {
    @OneWay
    void compute(Job<T,E> job);
    void start();
    void stop();
}

Instead WorkpoolService implements WorkerServiceCallback:

@Remotable
public interface WorkerServiceCallback {
        void receiveResult(Job resultType,  boolean reuse,
ServiceReferenceImpl<WorkerService> serviceReference);
}

I generate a reference to a given worker component, i pass it as
CallableReference to
another component,

@Service(WorkpoolService.class)
@Scope("COMPOSITE")
@DataBinding("org.apache.tuscany.sca.databinding.job.Job")


public class WorkpoolServiceImpl implements WorkpoolService,
WorkerServiceCallback .


Now my requirement is to add dynamically a callback to the worker, but
it fails.So when a callback gets wired to a component?
I have a pair of hypothesis: the first is that a worker needs to set a
callback in its own runtime (in my case i set the callback in the
workpool runtime, which is in another host), the second is that's
something that i don't understand :).

Cheers,
Giorgio.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to