use of org.switchyard.component.test.mixins.hornetq.HornetQMixIn in project quickstarts by jboss-switchyard.
the class JMSClient method sendToHornetQ.
private static void sendToHornetQ(String value) throws Exception {
HornetQMixIn hqMixIn = new HornetQMixIn(false).setUser(USER).setPassword(PASSWD);
hqMixIn.initialize();
try {
Session session = hqMixIn.getJMSSession();
final MessageProducer producer = session.createProducer(HornetQMixIn.getJMSQueue(REQUEST_NAME));
final MessageConsumer consumer = session.createConsumer(HornetQMixIn.getJMSQueue(REPLY_NAME));
producer.send(hqMixIn.createJMSMessage(createPayload(value)));
System.out.println("Message sent. Waiting for reply ...");
Message message = consumer.receive(3000);
String reply = hqMixIn.readStringFromJMSMessage(message);
System.out.println("REPLY: \n" + reply);
} finally {
hqMixIn.uninitialize();
}
}
use of org.switchyard.component.test.mixins.hornetq.HornetQMixIn in project quickstarts by jboss-switchyard.
the class OrderIntakeClient method main.
/**
* 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 {
System.out.println("Received reply" + "\n" + "----------------------------\n" + reply.getText() + "\n----------------------------");
}
} finally {
hqMixIn.uninitialize();
}
}
use of org.switchyard.component.test.mixins.hornetq.HornetQMixIn in project quickstarts by jboss-switchyard.
the class JMSClient method sendToHornetQ.
private static void sendToHornetQ(String payload, String queueName) throws Exception {
HornetQMixIn hqMixIn = new HornetQMixIn(false).setUser(HQ_USER).setPassword(HQ_PASSWD);
hqMixIn.initialize();
try {
Session session = hqMixIn.getJMSSession();
MessageProducer producer = session.createProducer(HornetQMixIn.getJMSQueue(queueName));
producer.send(hqMixIn.createJMSMessage(payload));
session.close();
verifyOutputQueue(hqMixIn.createJMSSession());
} finally {
hqMixIn.uninitialize();
}
}
use of org.switchyard.component.test.mixins.hornetq.HornetQMixIn in project quickstarts by jboss-switchyard.
the class OrderIntakeClient method main.
/**
* 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();
}
}
use of org.switchyard.component.test.mixins.hornetq.HornetQMixIn in project quickstarts by jboss-switchyard.
the class HornetQClient method main.
/**
* Only execution point for this application.
* @param ignored not used.
* @throws Exception if something goes wrong.
*/
public static void main(final String[] args) throws Exception {
HornetQMixIn hqMixIn = new HornetQMixIn(false).setUser(USER).setPassword(PASSWD);
if (args.length == 0) {
System.err.println("ERROR: Use -Dexec.args to pass a name and language value, e.g. -Dexec.args=\"Skippy english\"");
return;
}
hqMixIn.initialize();
try {
final Session session = hqMixIn.createJMSSession();
final MessageProducer producer = session.createProducer(HornetQMixIn.getJMSQueue(QUEUE));
final TextMessage message = session.createTextMessage();
String payload = TEMPLATE.replace("@name@", args[0]);
if (args.length == 2) {
payload = payload.replace("@lang@", args[1]);
} else {
payload = payload.replace("@lang@", "english");
}
System.out.println(payload);
message.setText(payload);
producer.send(message);
System.out.println("Sent message [" + message + "]");
Thread.sleep(2000);
} finally {
hqMixIn.uninitialize();
}
}
Aggregations