To create CLIENT_ACKNOWLEDGE session as :
connection.createSession(false, javax.jms.Session.CLIENT_ACKNOWLEDGE)
Here I will acknowledge message only after the successful completion of transactions(stored procedures)
With client acknowledge, when you acknowledge a message, all previously unacknowledged messages are also automatically acknowledged.
To use transacted session
commit() on a transacted session commits all messages in that session. Which means you have to use a new connection and create a new session() per message you receive. In other words your receiver should end it's work after each message.
If you simply want messages to be redelivered if there is an error in processing, set the acknowledge mode to auto acknowledge and throw an exception from within the receiver. With auto acknowledge messages are acknowledged only when the onMessage() method succesfully returns. If there is an exception, messages will be redelivered.
Going back to your original question which was
a condition in which messages are received from Queue and are being processed in java, in the mean time both Queue and Topic will be down. Then how to handle those messages which are not on queue and not send to topic but are in java memory?
The answer to that would be option 3 (the least preferred

) in your original post - have error utility which will take messages from log and process them and send to Topic
cheers,
ram.