xmlBlaster/demo/javaclients/cluster/README 2006-02-20, marcel Please read the cluster requirement http://www.xmlblaster.org/xmlBlaster/doc/requirements/cluster.html first. NOTE 1: You HAVE TO start all examples in the current directory xmlBlaster/demo/javaclients/cluster to assure the xmlBlasterPlugins.xml and *.properties files are found. NOTE 2: Assure that xmlBlasterPlugins.xml has the plugin 'cluster' configured with the create='true' attribute (this is the default setting) NOTE 3: You can switch on specific logging to get a better idea what happens, typically this is a good choice: -logging/org.xmlBlaster.engine.RequestBroker FINER -logging/org.xmlBlaster.engine.cluster FINE -logging/org.xmlBlaster.client FINE NOTE 4: The demo below has following setup. 'avalon' is a slave to 'heron' for 'RUGBY_NEWS' messages. The publisher publishes to the slave and the subscriber subscribes from the master. 2. Start avalon (the xmlBlaster slave node): ============================================ cd xmlBlaster/demo/javaclients/cluster Edit avalon.properties and change the IP variable to your host (the host where golan runs later). java -Dcom.sun.management.jmxremote org.xmlBlaster.Main -propertyFile avalon.properties -logging/org.xmlBlaster.engine.RequestBroker FINE 'avalon.mycomp.com' listens now on bootstrapPort 7601. We have switched on logging of method calls in the 'core' to see when messages arrive. You can use the JMX 'jconsole' GUI application if you want to have more control over avalon. 3. Start a client connecting to avalon: ======================================= java -Dcom.sun.management.jmxremote javaclients.HelloWorldPublish -protocol IOR -bootstrapPort 7601 -numPublish 20 -session.name pubisher/2 -persistent true -oid PublishToSlave.RUGBY_NEWS -domain RUGBY_NEWS -content "We win" This publisher connects to the slave 'avalon'. The bootstrapPort 7601 is the same as specified for avalon in avalon.properties. We publish up to 20 messages, each must be sent by hitting enter on your console. We login with the name 'publisher' with the well known public session ID '2' which allows us to poll for the server 'avalon' if it is not yet running on our startup. 4. Start heron (the master): ============================ java -Dcom.sun.management.jmxremote org.xmlBlaster.Main -propertyFile heron.properties -logging/org.xmlBlaster.engine.RequestBroker FINER Heron should be contacted by avalon and receive the tailed back message sent by pubisher/2 5. Add a subscriber: ==================== java -Dcom.sun.management.jmxremote javaclients.HelloWorldSubscribe -protocol IOR -bootstrapPort 7600 -oid PublishToSlave.RUGBY_NEWS -session.name subscriber/1 -domain RUGBY_NEWS -persistentSubscribe true -multiSubscribe false -dispatch/callback/retries -1 This subscriber connects to 'heron' (port 7600) which is the master of 'PublishToSlave.RUGBY_NEWS' messages. We use the login name 'subscriber' and force the public session id '1' to be able to reconnect to the same session on failure. NOTE: You can now play with this setup, for example kill a cluster node, publish a message and restart the cluster node to verify that no messages are lost. Example configuration: ======================================== # Replace this with your IP: IP=192.168.1.2 cluster.node[heron.mycomp.com]=\ \ \
${IP}:7600
\
\ \ ]]>\ \
cluster.node.info[avalon.mycomp.com]=\ \ \
${IP}:7601
\
\
cluster.node.master[avalon.mycomp.com]=\ \ \ ]]>\ \ cluster.node.info[golan.mycomp.com]=\ \ \
${IP}:7602
\
\
cluster.node.master[golan.mycomp.com]=\ \ \ \ \ Example setup with publisher to heron and subscriber at avalon ======================================== java -Dcom.sun.management.jmxremote org.xmlBlaster.Main -propertyFile heron.properties java -Dcom.sun.management.jmxremote org.xmlBlaster.Main -propertyFile avalon.properties java -Dcom.sun.management.jmxremote javaclients.HelloWorldPublish -protocol IOR -bootstrapPort 7600 -numPublish 100 -interactivePublish true -session.name pubisher/2 -persistent true -erase.forceDestroy true -oid PublishToSlave.RUGBY_NEWS -domain RUGBY_NEWS -content "We win" java -Dcom.sun.management.jmxremote javaclients.HelloWorldSubscribe -protocol IOR -bootstrapPort 7601 -oid PublishToSlave.RUGBY_NEWS -session.name subscriber/1 -domain RUGBY_NEWS -persistentSubscribe true -dispatch/callback/retries -1 -multiSubscribe false Sniff all messages passing thru: java javaclients.simplereader.SimpleReaderGui -protocol IOR -bootstrapPort 7600 java javaclients.simplereader.SimpleReaderGui -protocol IOR -bootstrapPort 7601 $JAVA_HOME/bin/jconsole