Basically I want to know which can be instantiated once and which
should be instantiated for every call.
To answer this question, you could do the initialization as many time as you want. As long as you are releasing each of the session properly and closing the connection properly it is not an issue.
But from performance perspective, what should be the way?
Well, the answer depends on how frequently you are interacting with the queue. Say you want to perform once in a while read / write to the queue/topic, go for putting all the initialization code in a method, which would initialize the session , read/write data and close it.
But say, you have to perform the read/write very often, it is a good idea to initialize the session and keep the reference in an instance variable and then you method would simply use this session to put data.
Keep the operation in try-catch to catch any exception (in all the cases). And use a finally block to close the session/connection.
After all read-write is over, close the session and connection through a finally block.