Can you share your standalone...xml?
With this code, you get exactly behavior you described
What you do is, open new connection everytime you send a (new) message.
and on the end you don't close connection to the server, as you dont close initial context.
I would recommend you to change a code a bit that wont be opening new connection to server for ever message sent.
by creating initial context only once and reuse it.
if noting else, close ctx in finally block.
Thanks for the suggestions provided.If I've not closed the connection in finally block,and if i remove those qsession.close(),qsender.close();,qcon.close() statements in finally block(above code),when that connection will be closed after publishing of all 1000 messages.And how to use that ctx that created once in all publishing messages.I should not create new connection in code sending the every message,how can i reuse that context.Kindly help me out in achieving the same.