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,23 +221,28 @@ public class PostOfficeJournalLoader implements JournalLoader {
|
|||
long currentTime = System.currentTimeMillis();
|
||||
|
||||
for (AddMessageRecord record : valueRecords) {
|
||||
long scheduledDeliveryTime = record.getScheduledDeliveryTime();
|
||||
try {
|
||||
long scheduledDeliveryTime = record.getScheduledDeliveryTime();
|
||||
|
||||
if (scheduledDeliveryTime != 0 && scheduledDeliveryTime <= currentTime) {
|
||||
scheduledDeliveryTime = 0;
|
||||
record.getMessage().setScheduledDeliveryTime(0L);
|
||||
}
|
||||
if (scheduledDeliveryTime != 0 && scheduledDeliveryTime <= currentTime) {
|
||||
scheduledDeliveryTime = 0;
|
||||
record.getMessage().setScheduledDeliveryTime(0L);
|
||||
}
|
||||
|
||||
if (scheduledDeliveryTime != 0) {
|
||||
record.getMessage().setScheduledDeliveryTime(scheduledDeliveryTime);
|
||||
}
|
||||
if (scheduledDeliveryTime != 0) {
|
||||
record.getMessage().setScheduledDeliveryTime(scheduledDeliveryTime);
|
||||
}
|
||||
|
||||
MessageReference ref = postOffice.reload(record.getMessage(), queue, null);
|
||||
MessageReference ref = postOffice.reload(record.getMessage(), queue, null);
|
||||
|
||||
ref.setDeliveryCount(record.getDeliveryCount());
|
||||
ref.setDeliveryCount(record.getDeliveryCount());
|
||||
|
||||
if (scheduledDeliveryTime != 0) {
|
||||
record.getMessage().setScheduledDeliveryTime(0L);
|
||||
if (scheduledDeliveryTime != 0) {
|
||||
record.getMessage().setScheduledDeliveryTime(0L);
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
ActiveMQServerLogger.LOGGER.unableToLoadMessageFromJournal(t);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue