0
下面的代碼不發送消息到WebSphere Application JMS隊列,但這個工程在JBoss EAP服務器(具有不同的JNDI的)JMS的WebSphere Message失去了對發送
從日誌中我可以看到該消息發送但未出現在Websphere隊列中。
有什麼建議嗎?下面的代碼。
InitialContext ic = new InitialContext();
logger.info("Connection factory");
ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
logger.info("Queue");
Queue orderQueue = (Queue)ic.lookup("java:/jms/queue/test");
logger.info("Connection");
Connection connection = cf.createConnection();
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
MessageProducer producer = session.createProducer(orderQueue);
connection.start();
TextMessage message = session.createTextMessage("This is an order");
producer.send(message);