mattrpav commented on code in PR #2136:
URL: https://github.com/apache/activemq/pull/2136#discussion_r3453617940


##########
activemq-broker/src/main/java/org/apache/activemq/broker/region/QueueSubscription.java:
##########
@@ -100,4 +100,27 @@ protected boolean isDropped(MessageReference node) {
        return result;
     }
 
+    // For queues if a message is in a bad state it could get stuck and will 
block good
+    // messages from being processed. We don't want to handle all errors as 
not all
+    // mean the message is bad, but if we specifically know the message is 
corrupted
+    // then we should remove and DLQ as it may be stuck and not possible to 
ever dispatch.
+    @Override
+    protected boolean matchesSelector(MessageReference node, 
MessageEvaluationContext context)
+            throws JMSException, ActiveMQMessageFormatException {
+        try {
+            return super.matchesSelector(node, context);
+        } catch (JMSException e) {
+            // This may cause the headers to unmarshal which could throw 
ActiveMQUnmarshalException
+            // The body could also be unmarshaled if using XPATH and could 
trigger a
+            // MessageDataFormat exception which this also handles.
+            ActiveMQMessageFormatException error = 
ExceptionUtils.createMessageFormatException(e);
+            if (error != null) {
+                LOG.error("Message could not be read for selector evaluation: 
{}", e.getMessage(), e);
+                throw error;

Review Comment:
   probably name this formatError to match variable name above



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact


Reply via email to