try {
String tempTopicOid = updateQos.getClientProperty(Constants.JMS_REPLY_TO, ""); // __jms:JMSReplyTo
log.info(receiverName+": Got request, using topic '" + tempTopicOid + "' for response");
// Send reply back ...
PublishKey pk = new PublishKey(receiver.getGlobal(), tempTopicOid, "text/plain", "1.0");
PublishQos pq = new PublishQos(receiver.getGlobal());
MsgUnit msgUnit = new MsgUnit(pk, "On doubt no ultimate truth, my dear.", pq);
//try { Thread.sleep(8000); } catch (InterruptedException e) { e.printStackTrace(); }
PublishReturnQos retQos = receiver.publish(msgUnit);
log.info(receiverName+": Published reply message using temporary topic " + retQos.getKeyOid());
}
catch (XmlBlasterException e) {
log.severe(receiverName+": Sending reply to " + updateQos.getSender() + " failed: " + e.getMessage());
}
return "";
}
}); // Login to xmlBlaster, default handler for updates
log.info("Receiver connected to xmlBlaster " + conRetQos.getSessionName().getRelativeName());
}
// Send a message to 'receiver' and block for the reply
PublishKey pk = new PublishKey(sender.getGlobal(), "requestForEnlightenment");
PublishQos pq = new PublishQos(sender.getGlobal());
pq.addDestination(new Destination(new SessionName(sender.getGlobal(), receiverName)));
MsgUnit msgUnit = new MsgUnit(pk, "Tell me the truth!", pq);
MsgUnit[] replies = sender.request(msgUnit, 3000, 1);
assertEquals("Missing reply message.", 1, replies.length);