1 25 package cluster.topic; 26 27 import org.objectweb.joram.client.jms.admin.*; 28 import org.objectweb.joram.client.jms.*; 29 import org.objectweb.joram.client.jms.tcp.*; 30 31 34 public class ClusterAdmin 35 { 36 public static void main(String [] args) throws Exception 37 { 38 System.out.println(); 39 System.out.println("Cluster of topics administration..."); 40 41 AdminModule.connect("root", "root", 60); 42 43 User user00 = User.create("publisher00", "publisher00", 0); 44 User user10 = User.create("subscriber10", "subscriber10", 1); 45 User user20 = User.create("subscriber20", "subscriber20", 2); 46 User user21 = User.create("subscriber21", "subscriber21", 2); 47 48 javax.jms.ConnectionFactory cf0 = 49 TcpConnectionFactory.create("localhost", 16010); 50 javax.jms.ConnectionFactory cf1 = 51 TcpConnectionFactory.create("localhost", 16011); 52 javax.jms.ConnectionFactory cf2 = 53 TcpConnectionFactory.create("localhost", 16012); 54 55 Topic top0 = (Topic) Topic.create(0); 56 Topic top1 = (Topic) Topic.create(1); 57 Topic top2 = (Topic) Topic.create(2); 58 59 top0.setFreeReading(); 60 top1.setFreeReading(); 61 top2.setFreeReading(); 62 top0.setFreeWriting(); 63 top1.setFreeWriting(); 64 top2.setFreeWriting(); 65 66 top0.addClusteredTopic(top1); 67 top0.addClusteredTopic(top2); 68 69 javax.naming.Context jndiCtx = new javax.naming.InitialContext (); 70 jndiCtx.bind("cf0", cf0); 71 jndiCtx.bind("cf1", cf1); 72 jndiCtx.bind("cf2", cf2); 73 jndiCtx.bind("top0", top0); 74 jndiCtx.bind("top1", top1); 75 jndiCtx.bind("top2", top2); 76 jndiCtx.close(); 77 78 AdminModule.disconnect(); 79 System.out.println("Admin closed."); 80 } 81 } 82 | Popular Tags |