Forum Stats

  • 3,758,923 Users
  • 2,251,475 Discussions
  • 7,870,436 Comments

Discussions

How to Receive fixed number of Messages from Queue

866600
866600 Member Posts: 66
edited Feb 26, 2013 6:35AM in Java Message Service (JMS)
Hi Guys,
I have requirement of pooling messages from queue using MDB of ejb3.x and I have to insert every 10 records at a time.Receiving messages and sending messages is working with queues but how to receive fixed number of messages with the implemented class of MessageListener.

Thanks,
Srinivas.

Edited by: 863597 on Feb 25, 2013 11:32 PM

Answers

  • Kayaman
    Kayaman Member Posts: 3,844 Silver Trophy
    Since there's no way to receive N messages at a time (at least that I know of, I may be wrong so you should research it), you would need to create your own holding queue in the MessageListener, that stores the received messages.
    When it's filled with 10 messages, you should do a batch insert.
    Kayaman
  • 866600
    866600 Member Posts: 66
    Thank you Kayaman ,
    I will proceed and continue to store the data after receiving from queue.

    Thanks,
    Srinivas.
This discussion has been closed.