I tried the solution you posted. But it seems the message is still be consumed after setRollBackOnly. Any idea?
The code is specified below: Both system print messages are displayed on the prompt.
boolean isStop=true;
try{
if(isStop){
System.out.println("The Message will send back to the queue for redelivering");
context.setRollbackOnly();
}
String msgFileName = (StreamMessage)message.readString();
System.out.println("Get sourceFile:"+msgFileName );