if we don't, we have "message rolled back" every second (or even faster) in the logfile - and if we reach the recipient there can be log entries also which are written several (undred) times per minute. big logfiles, unreadable logfiles, no disk space left, .. that is the difference
oh, i thought you were saying you had to do it because of some bug, why not do this so you only log an error once
@Override
public void onMessage(Message msg) {
try {
TextMessage textMessage = (TextMessage) msg;
String text = textMessage.getText();
if (testFile.exists()) {
ejbContext.setRollbackOnly();
if(!logged) {
logger.log(Level.INFO, "Rolled back message {0}", text);
logged = true;
}
} else {
logged = false;
logger.log(Level.INFO, "Message delivered {0}", text);
}
} catch (JMSException ex) {
logger.log(Level.SEVERE, "Exception occured: {0}", ex);
}
}
something like that could work on our side, but instead of logging the message we transfer the data to another server - and this logging we cannot change. Anyway - we have at least a workaround.