0
votes

I have sent messages to a JMS Queue using a Servlet;
and there is Message Listener for that Queue
but I m not using those messages anywhere;
but when I check the Messages in the Queue using WebLogic Admin console; it is not displaying any messages although it is indicating that there are 20 messages in Total.
Kindly tell me what I can do to save the sent messages in the JMS Queue??
Any guidance or suggestion would be highly appreciable. Thank you!

1

1 Answers

0
votes

I am not WebLogic expert but generally speaking:

The messages are saved by a JMS provider till they are consumed. So you don't need to do anything to save those message in a JMS queue.

It is possible that the message listener has already consumed those messages and the Admin Console is showing "Total messages processed" and not currently available messages?

Update

Sample for sending persistent messages. Set the DeliverMode as PERSISTENT. All message sent using this producer will be Persistent.

            // Create the destination (Topic or Queue)
            Destination destination = session.createQueue("TESTQ");

            // Create a MessageProducer from the Session to the Topic or Queue
            MessageProducer producer = session.createProducer(destination);
            // We want persistent messages
            producer.setDeliveryMode(DeliveryMode.PERSISTENT);