Newton: Connecting external Jini services
Overiew
In order for external Jini services to communicate with services launched from within Newton it is necessary for them to be able to connect to CDS urls (which are used to mark the rmi codebase on services exported from Newton).
The following example demonstrates how to extend the Chainlink Demo to incorporate an external (non Newton) link in the chain.
Example
First start Newton and launch reggie
$ newton.sh ... > installer install core/instances/reggie-instance.xml > installer install core/instances/server-cds-instance.xml
Publish demo lib the jars to the cds server
cds scan remote demo/build/lib
The following two lines start components that allow external clients to interpret cds urls - the first is a component that proxies cds requests over http. The second is a multicast beacon that allows external clients to discover where this http proxy is located.
installer install core/instances/cds-external-instance.xml installer install core/instances/beacon-instance.xml
Finally start the chainlink components a and c and the cli as per the default chainlink demo
installer install demo/xml/chainlink/chainlink-jini-a.xml installer install demo/xml/chainlink/chainlink-jini-c.xml installer install demo/xml/chainlink/chainlink-jini-cli-a.xml
Now from the command line do the following
cd $newton_install/demo/resources/chainlink sh external-chainlink.sh
(or windows)
cd %CONTAINER_INSTALL%\demo\resources\chainlink external-chainlink.bat
When you type <code>jinichain chain</code> from within Newton you should now see that the b component has been provided by the external jvm launched from the script.
Discussion
Within the external-chainlink scripts we have referenced the property:
-Djava.protocol.handler.pkgs=org.cauldron.newton.net.protocol
This plugs in a Java protocol handler which communicates with the http bridge from the jar file
$NEWTON_HOME/lib/core/bundles/cds-external-client.jar
This and the lib
$NEWTON_HOME/lib/core/app/if-jini-boot.jar
are the only things that need to be added to an external jini client in order to allow them to intercommunicate with components instantiated within Newton.
For the cds beacon the default multicast group is 228.192.0.2 and the port is 2028. These defaults can be overridden if need be by setting system properties org.cauldron.newton.net.channel.mcast.addr and org.cauldron.newton.net.channel.mcast.port.


