diff -Nru activemq-5.16.0/activemq-all/pom.xml activemq-5.16.1/activemq-all/pom.xml
--- activemq-5.16.0/activemq-all/pom.xml 2020-06-25 05:26:13.000000000 +0000
+++ activemq-5.16.1/activemq-all/pom.xml 2021-01-14 13:00:24.000000000 +0000
@@ -14,7 +14,7 @@
org.apache.activemq
activemq-parent
- 5.16.0
+ 5.16.1
activemq-all
diff -Nru activemq-5.16.0/activemq-amqp/pom.xml activemq-5.16.1/activemq-amqp/pom.xml
--- activemq-5.16.0/activemq-amqp/pom.xml 2020-06-25 05:26:13.000000000 +0000
+++ activemq-5.16.1/activemq-amqp/pom.xml 2021-01-14 13:00:24.000000000 +0000
@@ -22,7 +22,7 @@
org.apache.activemq
activemq-parent
- 5.16.0
+ 5.16.1
activemq-amqp
diff -Nru activemq-5.16.0/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/protocol/AmqpSender.java activemq-5.16.1/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/protocol/AmqpSender.java
--- activemq-5.16.0/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/protocol/AmqpSender.java 2020-06-25 05:26:13.000000000 +0000
+++ activemq-5.16.1/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/protocol/AmqpSender.java 2021-01-14 13:00:24.000000000 +0000
@@ -280,7 +280,7 @@
// the DLQ. If a custom redelivery policy is used on the broker the message
// can still be redelivered based on the configation of that policy.
LOG.trace("onDelivery: Rejected state = {}, message poisoned.", state);
- settle(delivery, MessageAck.POSION_ACK_TYPE);
+ settle(delivery, MessageAck.POISON_ACK_TYPE);
} else if (state instanceof Released) {
LOG.trace("onDelivery: Released state = {}", state);
// re-deliver && don't increment the counter.
@@ -297,7 +297,7 @@
if (undeliverableHere != null && undeliverableHere) {
// receiver does not want the message..
// perhaps we should DLQ it?
- ackType = MessageAck.POSION_ACK_TYPE;
+ ackType = MessageAck.POISON_ACK_TYPE;
}
settle(delivery, ackType);
}
Binary files /tmp/tmpuvqhec/1y0pmNA3Cr/activemq-5.16.0/activemq-amqp/src/test/resources/alternative.keystore and /tmp/tmpuvqhec/LpAcg9TglM/activemq-5.16.1/activemq-amqp/src/test/resources/alternative.keystore differ
Binary files /tmp/tmpuvqhec/1y0pmNA3Cr/activemq-5.16.0/activemq-amqp/src/test/resources/keystore and /tmp/tmpuvqhec/LpAcg9TglM/activemq-5.16.1/activemq-amqp/src/test/resources/keystore differ
diff -Nru activemq-5.16.0/activemq-amqp/src/test/resources/README.txt activemq-5.16.1/activemq-amqp/src/test/resources/README.txt
--- activemq-5.16.0/activemq-amqp/src/test/resources/README.txt 1970-01-01 00:00:00.000000000 +0000
+++ activemq-5.16.1/activemq-amqp/src/test/resources/README.txt 2021-01-14 13:00:24.000000000 +0000
@@ -0,0 +1,17 @@
+# The various keystores/truststores here were created with the following commands.
+# You can source this file to run it as a sript to regenerate them.
+
+# NOTE: This module isnt a good example of how to generate keypairs and use keystores. This should be replaced,
+# but needs various module-wide changes to the tests and their client/brokers use of keys/certs/trust.
+
+# Clean up existing files:
+# ------------------------
+rm -f keystore alternative.keystore
+
+# Create a key pair
+# -----------------
+keytool -storetype jks -keystore keystore -storepass password -keypass password -alias activemq -genkey -keyalg "RSA" -keysize 2048 -dname "O=ActiveMQ,CN=localhost" -validity 9999
+
+# Create an alternative keypair, to allow use in provoking 'failure to trust' it when matched against the above
+# ----------------------------------------------------------------------------------------------------------------------
+keytool -storetype jks -keystore alternative.keystore -storepass password -keypass password -alias alternative -genkey -keyalg "RSA" -keysize 2048 -dname "O=Alternative,CN=localhost" -validity 9999
diff -Nru activemq-5.16.0/activemq-blueprint/pom.xml activemq-5.16.1/activemq-blueprint/pom.xml
--- activemq-5.16.0/activemq-blueprint/pom.xml 2020-06-25 05:26:13.000000000 +0000
+++ activemq-5.16.1/activemq-blueprint/pom.xml 2021-01-14 13:00:24.000000000 +0000
@@ -22,7 +22,7 @@
org.apache.activemq
activemq-parent
- 5.16.0
+ 5.16.1
activemq-blueprint
diff -Nru activemq-5.16.0/activemq-broker/pom.xml activemq-5.16.1/activemq-broker/pom.xml
--- activemq-5.16.0/activemq-broker/pom.xml 2020-06-25 05:26:13.000000000 +0000
+++ activemq-5.16.1/activemq-broker/pom.xml 2021-01-14 13:00:24.000000000 +0000
@@ -22,7 +22,7 @@
org.apache.activemq
activemq-parent
- 5.16.0
+ 5.16.1
activemq-broker
diff -Nru activemq-5.16.0/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerService.java activemq-5.16.1/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerService.java
--- activemq-5.16.0/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerService.java 2020-06-25 05:26:13.000000000 +0000
+++ activemq-5.16.1/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerService.java 2021-01-14 13:00:24.000000000 +0000
@@ -203,6 +203,7 @@
private final AtomicBoolean preShutdownHooksInvoked = new AtomicBoolean(false);
private BrokerPlugin[] plugins;
private boolean keepDurableSubsActive = true;
+ private boolean enableMessageExpirationOnActiveDurableSubs = false;
private boolean useVirtualTopics = true;
private boolean useMirroredQueues = false;
private boolean useTempMirroredQueues = true;
@@ -1729,6 +1730,14 @@
public void setKeepDurableSubsActive(boolean keepDurableSubsActive) {
this.keepDurableSubsActive = keepDurableSubsActive;
}
+
+ public boolean isEnableMessageExpirationOnActiveDurableSubs() {
+ return enableMessageExpirationOnActiveDurableSubs;
+ }
+
+ public void setEnableMessageExpirationOnActiveDurableSubs(boolean enableMessageExpirationOnActiveDurableSubs) {
+ this.enableMessageExpirationOnActiveDurableSubs = enableMessageExpirationOnActiveDurableSubs;
+ }
public boolean isUseVirtualTopics() {
return useVirtualTopics;
diff -Nru activemq-5.16.0/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/AnnotatedMBean.java activemq-5.16.1/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/AnnotatedMBean.java
--- activemq-5.16.0/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/AnnotatedMBean.java 2020-06-25 05:26:13.000000000 +0000
+++ activemq-5.16.1/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/AnnotatedMBean.java 2021-01-14 13:00:24.000000000 +0000
@@ -202,6 +202,7 @@
@Override
public Object invoke(String s, Object[] objects, String[] strings) throws MBeanException, ReflectionException {
+ objects = (objects == null) ? new Object[]{} : objects;
JMXAuditLogEntry entry = null;
if (audit != OFF) {
Subject subject = Subject.getSubject(AccessController.getContext());
diff -Nru activemq-5.16.0/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/DestinationsViewFilter.java activemq-5.16.1/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/DestinationsViewFilter.java
--- activemq-5.16.0/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/DestinationsViewFilter.java 2020-06-25 05:26:13.000000000 +0000
+++ activemq-5.16.1/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/DestinationsViewFilter.java 2021-01-14 13:00:24.000000000 +0000
@@ -196,7 +196,7 @@
Object leftValue = getter.invoke(left.getValue());
Object rightValue = getter.invoke(right.getValue());
if (leftValue instanceof Comparable && rightValue instanceof Comparable) {
- if (getSortOrder().toLowerCase().equals("desc")) {
+ if (getSortOrder().equalsIgnoreCase("desc")) {
return ((Comparable) rightValue).compareTo(leftValue);
} else {
return ((Comparable) leftValue).compareTo(rightValue);
diff -Nru activemq-5.16.0/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/JobSchedulerView.java activemq-5.16.1/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/JobSchedulerView.java
--- activemq-5.16.0/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/JobSchedulerView.java 2020-06-25 05:26:13.000000000 +0000
+++ activemq-5.16.1/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/JobSchedulerView.java 2021-01-14 13:00:24.000000000 +0000
@@ -24,10 +24,14 @@
import javax.management.openmbean.TabularDataSupport;
import javax.management.openmbean.TabularType;
+import org.apache.activemq.Message;
+import org.apache.activemq.ScheduledMessage;
import org.apache.activemq.broker.jmx.OpenTypeSupport.OpenTypeFactory;
import org.apache.activemq.broker.scheduler.Job;
import org.apache.activemq.broker.scheduler.JobScheduler;
import org.apache.activemq.broker.scheduler.JobSupport;
+import org.apache.activemq.openwire.OpenWireFormat;
+import org.apache.activemq.util.ByteSequence;
/**
* MBean object that can be used to manage a single instance of a JobScheduler. The object
@@ -77,6 +81,24 @@
}
@Override
+ public int getDelayedMessageCount() throws Exception {
+ int counter = 0;
+ OpenWireFormat wireFormat = new OpenWireFormat();
+ for (Job job : jobScheduler.getAllJobs()) {
+ Message msg = (Message) wireFormat.unmarshal(new ByteSequence(job.getPayload()));
+ if (msg.getLongProperty(ScheduledMessage.AMQ_SCHEDULED_DELAY) > 0) {
+ counter++;
+ }
+ }
+ return counter;
+ }
+
+ @Override
+ public int getScheduledMessageCount() throws Exception {
+ return this.jobScheduler.getAllJobs().size();
+ }
+
+ @Override
public TabularData getNextScheduleJobs() throws Exception {
OpenTypeFactory factory = OpenTypeSupport.getFactory(Job.class);
CompositeType ct = factory.getCompositeType();
diff -Nru activemq-5.16.0/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/JobSchedulerViewMBean.java activemq-5.16.1/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/JobSchedulerViewMBean.java
--- activemq-5.16.0/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/JobSchedulerViewMBean.java 2020-06-25 05:26:13.000000000 +0000
+++ activemq-5.16.1/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/JobSchedulerViewMBean.java 2021-01-14 13:00:24.000000000 +0000
@@ -122,4 +122,24 @@
@MBeanInfo("get the scheduled Jobs in the Store within the time range. Not HTML friendly ")
public abstract TabularData getAllJobs(@MBeanInfo("start: yyyy-MM-dd hh:mm:ss")String start,@MBeanInfo("finish: yyyy-MM-dd hh:mm:ss")String finish)throws Exception;
+ /**
+ * Get the number of messages in the scheduler.
+ *
+ * @return the number of messages in the scheduler.
+ *
+ * @throws Exception if an error occurs while querying the scheduler store.
+ */
+ @MBeanInfo("get the number of scheduled message (basically message in the scheduler")
+ public abstract int getScheduledMessageCount() throws Exception;
+
+ /**
+ * Get the number of delayed messages.
+ *
+ * @return the number of delayed messages.
+ *
+ * @throws Exception if an error occurs while querying the scheduler store.
+ */
+ @MBeanInfo("get the number of delayed message")
+ public abstract int getDelayedMessageCount() throws Exception;
+
}
diff -Nru activemq-5.16.0/activemq-broker/src/main/java/org/apache/activemq/broker/region/BaseDestination.java activemq-5.16.1/activemq-broker/src/main/java/org/apache/activemq/broker/region/BaseDestination.java
--- activemq-5.16.0/activemq-broker/src/main/java/org/apache/activemq/broker/region/BaseDestination.java 2020-06-25 05:26:13.000000000 +0000
+++ activemq-5.16.1/activemq-broker/src/main/java/org/apache/activemq/broker/region/BaseDestination.java 2021-01-14 13:00:24.000000000 +0000
@@ -894,7 +894,7 @@
Throwable cause = new Throwable(DUPLICATE_FROM_STORE_MSG_PREFIX + destination);
message.setRegionDestination(this);
broker.getRoot().sendToDeadLetterQueue(connectionContext, message, null, cause);
- MessageAck messageAck = new MessageAck(message, MessageAck.POSION_ACK_TYPE, 1);
+ MessageAck messageAck = new MessageAck(message, MessageAck.POISON_ACK_TYPE, 1);
messageAck.setPoisonCause(cause);
try {
acknowledge(connectionContext, subscription, messageAck, message);
diff -Nru activemq-5.16.0/activemq-broker/src/main/java/org/apache/activemq/broker/region/DurableTopicSubscription.java activemq-5.16.1/activemq-broker/src/main/java/org/apache/activemq/broker/region/DurableTopicSubscription.java
--- activemq-5.16.0/activemq-broker/src/main/java/org/apache/activemq/broker/region/DurableTopicSubscription.java 2020-06-25 05:26:13.000000000 +0000
+++ activemq-5.16.1/activemq-broker/src/main/java/org/apache/activemq/broker/region/DurableTopicSubscription.java 2021-01-14 13:00:24.000000000 +0000
@@ -58,6 +58,7 @@
private final ConcurrentMap durableDestinations = new ConcurrentHashMap();
private final SubscriptionKey subscriptionKey;
private boolean keepDurableSubsActive;
+ private boolean enableMessageExpirationOnActiveDurableSubs;
private final AtomicBoolean active = new AtomicBoolean();
private final AtomicLong offlineTimestamp = new AtomicLong(-1);
private final HashSet ackedAndPrepared = new HashSet();
@@ -69,6 +70,7 @@
this.pending.setSystemUsage(usageManager);
this.pending.setMemoryUsageHighWaterMark(getCursorMemoryHighWaterMark());
this.keepDurableSubsActive = keepDurableSubsActive;
+ this.enableMessageExpirationOnActiveDurableSubs = broker.getBrokerService().isEnableMessageExpirationOnActiveDurableSubs();
subscriptionKey = new SubscriptionKey(context.getClientId(), info.getSubscriptionName());
}
@@ -429,4 +431,8 @@
public boolean isKeepDurableSubsActive() {
return keepDurableSubsActive;
}
+
+ public boolean isEnableMessageExpirationOnActiveDurableSubs() {
+ return enableMessageExpirationOnActiveDurableSubs;
+ }
}
diff -Nru activemq-5.16.0/activemq-broker/src/main/java/org/apache/activemq/broker/region/policy/UniquePropertyMessageEvictionStrategy.java activemq-5.16.1/activemq-broker/src/main/java/org/apache/activemq/broker/region/policy/UniquePropertyMessageEvictionStrategy.java
--- activemq-5.16.0/activemq-broker/src/main/java/org/apache/activemq/broker/region/policy/UniquePropertyMessageEvictionStrategy.java 2020-06-25 05:26:13.000000000 +0000
+++ activemq-5.16.1/activemq-broker/src/main/java/org/apache/activemq/broker/region/policy/UniquePropertyMessageEvictionStrategy.java 2021-01-14 13:00:24.000000000 +0000
@@ -22,7 +22,7 @@
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
-
+import java.util.List;
/**
* An eviction strategy which evicts the oldest message within messages with the same property value
@@ -45,12 +45,10 @@
@Override
public MessageReference[] evictMessages(LinkedList messages) throws IOException {
- MessageReference oldest = (MessageReference)messages.getFirst();
- HashMap