1 package Jt.examples.jms; 2 3 import Jt.*; 4 import Jt.jms.*; 5 import java.io.*; 6 7 8 12 public class JMSReceiver { 13 14 15 17 public static void main(String [] args) { 18 19 JtFactory main = new JtFactory (); JtMessage msg; 21 String greeting; 22 String reply; 23 Jt.jms.JtJMSQueueAdapter jmsAdapter; 24 25 26 28 jmsAdapter = (Jt.jms.JtJMSQueueAdapter) main.createObject 29 ("Jt.jms.JtJMSQueueAdapter", "jmsAdapter"); 30 31 32 34 for (;;) { 35 36 msg = (JtMessage) main.sendMessage (jmsAdapter, new JtMessage ("JtRECEIVE")); 37 38 if (msg == null) { 39 System.out.println ("no more messages"); 40 break; 41 } 42 43 System.out.println ("msgId:" + msg.getMsgId ()); 44 45 } 46 47 48 50 main.removeObject ("jmsAdapter"); 51 52 53 54 } 55 56 } 57 58 59 60 | Popular Tags |