Above code is my message driven bean and working fine for single queue 'Queue1'. Now i want to associate Queue2 to same mdb.
I can do the same thing by creating another mdb class "EJB3MessageDrivenBean2" and by just changing activationConfig property as follow.
but in this method i have to replicate my code and in future if i have to associate another queue Queue3 then i have to again replicate java file.
Any other method by changing in xml file or any other method.
Why have different queues if one MDB is going to process them?
Have the MDB listen to only one queue and maybe look at using your JMS provider settings to automatically route messages to the queue being listened to if you have to have multiple queues.