});
messageReceiver.start();
//Initialize the broker
//BrokerClient brokerClient = new BrokerClient("http://127.0.0.1:9763/services/EventBrokerService");
BrokerClient brokerClient = new BrokerClient("https://127.0.0.1:9443/services/EventBrokerService", "admin", "admin");
//https://127.0.0.1:9443/services/BrokerSecurityManager
// brokerClient.createSecureTopic(topic, null, null);
// brokerClient.createSecureTopic(topic+"/bar", null, null);
// brokerClient.shareATopic(topic, null, new String[]{"everyone"});
//
// brokerClient = new BrokerClient("https://127.0.0.1:9443/services/EventBrokerService", "test", "test1234");
//
// //subscribe, notice we set the message sink to listener
// String listenerUrl = messageReceiver.getListenerUrl();
// System.out.println("listining with "+ listenerUrl);
//
// String subscribtionId = brokerClient.subscribe(topic, listenerUrl);
//
//
//String subscribtionId = brokerClient.subscribe(topic, "http://parakum:7777/axis2/services/MessageCollector/receive/");
OMFactory fac = OMAbstractFactory.getOMFactory();
for(int i = 0;i<2;i++){
OMElement ele = fac.createOMElement(new QName("http://wso2.org","foo"+i));
ele.setText("hello"+i);
brokerClient.publish(topic+"/bar", ele);
}
//
// brokerClient.unsubscribe(subscribtionId);
// brokerClient.deleteSecureTopic(topic);
//
// Thread.sleep(3000);
SubscriptionDetails[] allSubscriptions = brokerClient.getAllSubscriptions();
for(SubscriptionDetails details:allSubscriptions){
System.out.println(new Date(details.getCreatedTime().getTimeInMillis()));
}
}