From dcd3d5db3f14fbdb74d9595360033988405cce79 Mon Sep 17 00:00:00 2001 From: jbonofre Date: Tue, 3 Mar 2020 06:20:51 +0100 Subject: [PATCH] [AMQ-7394] Simple first fix to use listener.hasSpace() when recovering message from JDBC message store --- .../org/apache/activemq/store/jdbc/JDBCMessageStore.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/JDBCMessageStore.java b/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/JDBCMessageStore.java index 75c0751e08..0aa7efabc7 100644 --- a/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/JDBCMessageStore.java +++ b/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/JDBCMessageStore.java @@ -367,13 +367,17 @@ public class JDBCMessageStore extends AbstractMessageStore { @Override public boolean recoverMessage(long sequenceId, byte[] data) throws Exception { - Message msg = (Message)wireFormat.unmarshal(new ByteSequence(data)); + if (listener.hasSpace()) { + Message msg = (Message) wireFormat.unmarshal(new ByteSequence(data)); msg.getMessageId().setBrokerSequenceId(sequenceId); msg.getMessageId().setFutureOrSequenceLong(sequenceId); msg.getMessageId().setEntryLocator(sequenceId); listener.recoverMessage(msg); trackLastRecovered(sequenceId, msg.getPriority()); return true; + } else { + return false; + } } @Override