0
votes

The following code is not sending the message to a Websphere application JMS queue, however this works on a JBoss EAP server (with different JNDI's)

From the logs I can see that the message gets sent but does not appear on the Websphere queue.

Any suggestions? Code below.

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);
1

1 Answers

0
votes

If this code part of a transaction? are you managing the transaction yourself? Maybe adding session.commit() after your code would help