0

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!

Developer
  • 161
  • 2
  • 3
  • 15

1 Answers1

0

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);
Shashi
  • 14,980
  • 2
  • 33
  • 52
  • so, any idea how I can save those message in the Queue ;I don't wanna consume those messages; just want them to be inside the Queue ?? – Developer Apr 28 '14 at 05:05
  • Looks like I was not clear earlier. Let me reiterate: Once an application sends a message successfully to a JMS Provider, WebLogic in your case, the message is saved by JMS Provider (WebLogic here) till they are received by a consumer. You don't need to do anything. – Shashi Apr 28 '14 at 05:25
  • 1
    @Shashi Only if the message is PERSISTENT, otherwise, if the provider crashes, messages in memory will be lost; PERSISTENT messages are stored on disk by default. – raffian Apr 28 '14 at 15:29
  • True. Since the question did not mention about JMS provider crashing, I did not mention that point. – Shashi Apr 28 '14 at 16:28
  • Sashi and @raffian Thank you for helpful response; Now kindly tell me; if I use a Message Driven Bean with a queue but I don't link that MDB with any consumer; still they are getting lost..... I wanna know WHY?? and the second question is HOW to make messages persistent?? – Developer Apr 29 '14 at 03:26
  • Don't know the answer to 1st question. But see the update for sample on how to make messages persistent. – Shashi Apr 29 '14 at 03:42
  • 1
    @user3462765 the MDB is a consumer, so as long as it's listening to the queue, messages will be consumed from the queue; disable the MDB and only send to the queue, the messages will then remain on the queue – raffian Apr 29 '14 at 11:48
  • Okie One more question; Is there any way I can pre store messages into a Queue using Admin Console; and don't need to send them to Queue in order to store them into Queue. Thank you! – Developer Apr 30 '14 at 03:54