Methods Summary |
---|
public static int | getPostConstructCalls()
return postConstructCalls;
|
public static java.lang.String | getResult()
return result;
|
public static void | main(java.lang.String[] args)
String name = "unspecified";
if(args.length > 0)
name = args[0];
if(helloWorldService == null)
throw new NullPointerException("helloWorldService is null");
if(msg == null)
throw new NullPointerException("msg is null");
result = helloWorldService.sayHelloTo(name) + ", " + msg;
testMDB();
|
public static void | postConstruct()
postConstructCalls++;
|
public static void | testMDB()
if(connectionFactory == null)
throw new NullPointerException("connectionFactory is null");
if(destination == null)
throw new NullPointerException("destination is null");
try
{
Connection conn = connectionFactory.createConnection();
Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
Queue replyTo = session.createTemporaryQueue();
TextMessage msg = session.createTextMessage("Hello world");
msg.setJMSReplyTo(replyTo);
MessageConsumer consumer = session.createConsumer(replyTo);
conn.start();
MessageProducer producer = session.createProducer(destination);
producer.send(destination, msg);
TextMessage reply = (TextMessage) consumer.receive(2000);
System.out.println("reply = " + reply.getText());
producer.close();
conn.stop();
consumer.close();
session.close();
}
catch(Exception e)
{
throw new RuntimeException(e);
}
|