I have a javax.jms.Queue queue and have my listener listening to this queue. I get the message(a String) and execute a process passing the string as an input parameter to that process.

I want to just run 10 instances of that process running at one time. Once those are finished then only next messages should be processed.

How it can be achieved? As it reads all the message at once and runs as many instances of that process running, causing the server to be hanged.

```
// using javax.jms.MessageListener
message = consumer.receive(5000); 
if (message != null) { 
    try { 
        handler.onMessage(message);  //handler is MessageListener instance
    }
}

```