ARTEMIS-3501 Added exception handling on #handleAddMessage to not stop broker from starting with currupted messages
This commit is contained in:
parent
20511375de
commit
919245b3b3
|
@ -1759,6 +1759,10 @@ public interface ActiveMQServerLogger extends BasicLogger {
|
|||
@Message(id = 222303, value = "Redistribution by {0} of messageID = {1} failed", format = Message.Format.MESSAGE_FORMAT)
|
||||
void errorRedistributing(@Cause Throwable t, String queueName, long m);
|
||||
|
||||
@LogMessage(level = Logger.Level.WARN)
|
||||
@Message(id = 222304, value = "Unable to load message from journal", format = Message.Format.MESSAGE_FORMAT)
|
||||
void unableToLoadMessageFromJournal(@Cause Throwable t);
|
||||
|
||||
@LogMessage(level = Logger.Level.ERROR)
|
||||
@Message(id = 224000, value = "Failure in initialisation", format = Message.Format.MESSAGE_FORMAT)
|
||||
void initializationError(@Cause Throwable e);
|
||||
|
|
|
@ -221,6 +221,7 @@ public class PostOfficeJournalLoader implements JournalLoader {
|
|||
long currentTime = System.currentTimeMillis();
|
||||
|
||||
for (AddMessageRecord record : valueRecords) {
|
||||
try {
|
||||
long scheduledDeliveryTime = record.getScheduledDeliveryTime();
|
||||
|
||||
if (scheduledDeliveryTime != 0 && scheduledDeliveryTime <= currentTime) {
|
||||
|
@ -239,6 +240,10 @@ public class PostOfficeJournalLoader implements JournalLoader {
|
|||
if (scheduledDeliveryTime != 0) {
|
||||
record.getMessage().setScheduledDeliveryTime(0L);
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
ActiveMQServerLogger.LOGGER.unableToLoadMessageFromJournal(t);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue