Hello,
we implemented some kind of registering and broadcasting for one server and
multiple clients
running on different hosts using tuscany 1.3.1
The server implements two interfaces:
The server interfaces:
UpdateProvider for initiating the broadcast and
UpdateRegistry for the clients to register to the server.
Here are the interfaces for the server
@Remotable
public interface UpdateProvider {
public void broadcast(String e);
}
and
@Remotable
@Callback(UpdateListener.class)
public interface UpdateRegistry {
void register();
}
The server implementation:
public class UpdateServiceImpl implements UpdateProvider, UpdateRegistry {
@Callback
protected UpdateListener updateListener;
private static List<UpdateListener> listeners = new
Vector<UpdateListener>();
public void broadcast(String e) {
for (UpdateListener listener: listeners)
listener.receiveUpdate(e)
}
public void register() {
listeners.add(updateListener);
}
}
and the server composite:
<?xml version="1.0" encoding="UTF-8"?>
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
targetNamespace="http://updateservice"
xmlns:hw="http://updateservice"
name="Updateservice">
<component name="UpdateServiceImplComp">
<implementation.java class="test.UpdateServiceImpl"/>
<service name="UpdateProvider">
<binding.ws/>
</service>
<service name="UpdateRegistry">
<binding.ws/>
<callback>
<binding.ws/>
</callback>
</service>
</component>
</composite>
The clients have one interface for receiving the broadcasted event:
@Remotable
public interface UpdateListener {
void receiveUpdate(String re);
}
the client implementation
@Scope("COMPOSITE")
public class UpdateListenerImpl implements UpdateListener {
@Reference
protected UpdateRegistry updateRegistry;
public void receiveUpdate(String e) {}
public void init(){ updateRegistry.register(); }
}
and the client composite:
<?xml version="1.0" encoding="UTF-8"?>
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
targetNamespace="http://updatelistener"
xmlns:hw="http://updatelistener"
name="UpdateListener">
<component name="UpdateListenerImplCompHostA">
<implementation.java class="test.UpdateListenerImpl"/>
<service name="UpdateListener">
<binding.ws/>
</service>
<reference name="updateRegistry"
target="UpdateServiceImplComp/UpdateRegistry">
<binding.ws/>
<callback>
<binding.ws
uri="http://hosta:5501/UpdateListenerImplCompHostA/UpdateListener"/>
</callback>
</reference>
</component>
</composite>
Everything works fine,
the clients running on different hosts
receive the broadcasted events.
The only "problem":
we got the following warnings:
26.06.2009 14:25:52 org.apache.tuscany.sca.node.launcher.NodeLauncher main
INFO: Apache Tuscany SCA Node starting...
26.06.2009 14:25:52 org.apache.tuscany.sca.node.launcher.NodeLauncher main
INFO: SCA Node configuration:
http://localhost:9990/node-config/UpdateserviceNode
26.06.2009 14:25:53 org.apache.tuscany.sca.node.impl.NodeImpl
INFO: Creating node: http://localhost:9990/node-config/UpdateserviceNode
26.06.2009 14:25:53 org.apache.tuscany.sca.node.impl.NodeImpl configureNode
INFO: Loading contribution: file:/./components/updateservice.jar
26.06.2009 14:25:55 org.apache.tuscany.sca.node.impl.NodeImpl configureNode
INFO: Loading composite:
http://localhost:9990/composite-resolved/composite:updateservice;http://updateservice;Updateservice
26.06.2009 14:25:55
org.apache.tuscany.sca.assembly.builder.impl.ComponentConfigurationBuilderImpl
WARNUNG: Reference not found for component reference: Component =
UpdateServiceImplComp Reference = UpdateRegistry
26.06.2009 14:25:55
org.apache.tuscany.sca.assembly.builder.impl.CompositeBindingURIBuilderImpl
WARNUNG: Reference not found for component reference: Component =
UpdateServiceImplComp Reference = UpdateRegistry
26.06.2009 14:25:55
org.apache.tuscany.sca.assembly.builder.impl.CompositeBindingURIBuilderImpl
WARNUNG: Multiple bindings with the same name for a service: Binding =
UpdateRegistry Service =UpdateRegistry Binding = {2}
26.06.2009 14:25:56 org.apache.tuscany.sca.node.impl.NodeImpl start
INFO: Starting node: http://localhost:9990/node-config/UpdateserviceNode
26.06.2009 14:25:57 org.apache.tuscany.sca.http.jetty.JettyServer
addServletMapping
INFO: Added Servlet mapping:
http://roadrunner:5000/UpdateServiceImplComp/UpdateProvider
26.06.2009 14:25:57 org.apache.tuscany.sca.http.jetty.JettyServer
addServletMapping
INFO: Added Servlet mapping:
http://roadrunner:5000/UpdateServiceImplComp/UpdateRegistry
26.06.2009 14:25:57 org.apache.tuscany.sca.node.launcher.NodeLauncher main
INFO: SCA Node started.
26.06.2009 14:25:57 org.apache.tuscany.sca.node.launcher.NodeLauncher main
INFO: Press enter to shutdown.
Is it possible to avoid this warnings somehow ?
Mit freundlichem Gruß / Kind regards
Martin Thoma