You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@activemq.apache.org by GitBox <gi...@apache.org> on 2019/10/26 11:37:39 UTC

[GitHub] [activemq-artemis] cshannon edited a comment on issue #2872: ARTEMIS-2531: Fix filter in FederatedQueue to prevent infinite consumer creation in a circular or bidrectional setup

cshannon edited a comment on issue #2872: ARTEMIS-2531: Fix filter in FederatedQueue to prevent infinite consumer creation in a circular or bidrectional setup
URL: https://github.com/apache/activemq-artemis/pull/2872#issuecomment-546594924
 
 
   @michaelandrepearce - So maybe I didn't explain the original intent of this as well.  The ONLY problem here is that while the existing filter is correct it does not actually work properly because the SQL92 parsing logic breaks because the key for FederatedQueueConsumer.FEDERATION_NAME has a hyphen in it as the key name is `federation-name`  Because of the hyphen you have to prefix the key with hyphenated_props in order for the filter to actually work.  That's it...nothing else is wrong with the filter.  The other solution is to simply change the name of the key to not have a hyphen and problem fixed.  This is just a one line fix.
   
   Take a look at this documentation for filter expressions at the bottom: https://activemq.apache.org/components/artemis/documentation/latest/filter-expressions.html
   
   > The JMS spec also states that property identifiers (and therefore the identifiers which are valid for use in a filter expression) are an, "unlimited-length sequence of letters and digits, the first of which must be a letter. A letter is any character for which the method Character.isJavaLetter returns true. This includes _ and $. A letter or digit is any character for which the method Character.isJavaLetterOrDigit returns true." **This constraint means that hyphens (i.e. -) cannot be used. However, this constraint can be overcome by using the hyphenated_props: prefix.For example, if a message had the foo-bar property set to 0 then the filter expression hyphenated_props:foo-bar = 0 would match it.**
   
   If you are still confused or don't quite get what I am talking about I encourage you to run my updated test with and without the fix and you can see what I mean.  Without the fix the brokers will create infinite numbers of consumers because the filter is ignored because of the hyphen.  With the fix everything works as originally intended.  If you use break points in the debugger you will see the expression get evaluated to false even though it should be true and not work right.
   
   So again, I'm NOT trying to change the original intent..Im simply trying to actually fix what's supposed to already be there.  The original filter is correct and will work as intended if the parser can actually handled the hyphen.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services