if(line.startsWith("subscribe")) {
final String topic=line.substring("subscribe".length()).trim();
if(!topics.containsKey(topic)) {
// we need to make sure "singleton_name" is set in the transport
JChannel ch=createSharedChannel("pubsub", props);
ch.setReceiver(new ReceiverAdapter() {
public void receive(Message msg) {
System.out.println("[" + topic + "] << " + msg.getObject());
}
});
ch.connect(topic);