* Main routing for OrderIntakeClient
* @param args command-line args
* @throws Exception if something goes wrong.
*/
public static void main(final String[] args) throws Exception {
HornetQMixIn hqMixIn = new HornetQMixIn(false)
.setUser(USER)
.setPassword(PASSWD);
hqMixIn.initialize();
try {
Session session = hqMixIn.getJMSSession();
MessageProducer producer = session.createProducer(HornetQMixIn.getJMSQueue(ORDER_QUEUE_NAME));
String orderTxt = readFileContent(args[0]);
System.out.println("Submitting Order" + "\n"
+ "----------------------------\n"
+ orderTxt
+ "\n----------------------------");
producer.send(hqMixIn.createJMSMessage(orderTxt));
MessageConsumer consumer = session.createConsumer(HornetQMixIn.getJMSQueue(ORDERACK_QUEUE_NAME));
System.out.println("Order submitted ... waiting for reply.");
TextMessage reply = (TextMessage)consumer.receive(3000);
if (reply == null) {
System.out.println("No reply received.");
} else {
String str = reply.getText();
System.out.println("Received reply" + "\n"
+ "----------------------------\n"
+ str
+ "\n----------------------------");
}
} finally {
hqMixIn.uninitialize();
}
}