[ 
https://issues.apache.org/jira/browse/ARTEMIS-3137?focusedWorklogId=556846&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-556846
 ]

ASF GitHub Bot logged work on ARTEMIS-3137:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 24/Feb/21 10:11
            Start Date: 24/Feb/21 10:11
    Worklog Time Spent: 10m 
      Work Description: gemmellr commented on a change in pull request #3466:
URL: https://github.com/apache/activemq-artemis/pull/3466#discussion_r581819596



##########
File path: docs/user-manual/en/filter-expressions.md
##########
@@ -62,12 +62,39 @@ previous example to be `convert_string_expressions:age > 
18`, then it would
 match the aforementioned message.
 
 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.
+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.
\ No newline at end of file
+the filter expression `hyphenated_props:foo-bar = 0` would match it.
+
+## XPath
+
+Apache ActiveMQ Artemis also supports special 
[XPath](https://en.wikipedia.org/wiki/XPath)
+filters which operate on the *body* of a message. The body must be XML. To
+use an XPath filter use this syntax:
+```
+XPATH '<xpath-expression>'
+```
+### Caveats
+
+XPath filters are supported with and between producers and consumers using
+the following protocols:
+
+ - OpenWire JMS 
+ - Core (and Core JMS)
+ - STOMP
+ - AMQP with the caveat that the Qpid JMS client throws an exception when
+   trying to parse the `XPATH '<xpath-expression>'` syntax.

Review comment:
       Could instead just document how to disable the JMS selector validation 
to allow using the illegal value, per earlier comment.

##########
File path: artemis-distribution/src/main/assembly/dep.xml
##########
@@ -110,6 +110,8 @@
             <include>com.sun.xml.bind:jaxb-core</include>
             <include>javax.activation:activation</include>
             
<include>org.apache.geronimo.specs:geronimo-jaspic_1.0_spec</include>
+            <include>xalan:xalan</include>
+            <include>xml-apis:xml-apis</include>

Review comment:
       I'd probably continue to leave these out personally. It doesnt seem 
unreasonable for folks to have to drop the (very old) dep in for a highly 
specific feature many likely wont use (and noone could until now?). Its not 
difficult and could be documented.
   
   I see further down they were listed as optional before but this change 
removed that, essentially I'd restore that and just update the tests module.

##########
File path: 
tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSXPathSelectorTest.java
##########
@@ -0,0 +1,156 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.artemis.tests.integration.amqp;
+
+import javax.jms.Connection;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+
+import org.apache.activemq.artemis.api.core.QueueConfiguration;
+import org.apache.activemq.artemis.api.core.RoutingType;
+import org.apache.activemq.artemis.api.core.SimpleString;
+import org.apache.activemq.artemis.core.server.ActiveMQServer;
+import org.apache.activemq.artemis.core.server.impl.AddressInfo;
+import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class JMSXPathSelectorTest extends JMSClientTestSupport {
+
+   private static final String NORMAL_QUEUE_NAME = "NORMAL";
+
+   private ConnectionSupplier AMQPConnection = () -> createConnection();
+   private ConnectionSupplier CoreConnection = () -> createCoreConnection();
+   private ConnectionSupplier OpenWireConnection = () -> 
createOpenWireConnection();
+
+   @Override
+   protected String getConfiguredProtocols() {
+      return "AMQP,OPENWIRE,CORE";
+   }
+
+   @Override
+   protected void addConfiguration(ActiveMQServer server) {
+      server.getConfiguration().setPersistenceEnabled(false);
+      server.getAddressSettingsRepository().addMatch(NORMAL_QUEUE_NAME, new 
AddressSettings());
+   }
+
+   @Override
+   protected void createAddressAndQueues(ActiveMQServer server) throws 
Exception {
+      super.createAddressAndQueues(server);
+
+      //Add Standard Queue
+      server.addAddressInfo(new 
AddressInfo(SimpleString.toSimpleString(NORMAL_QUEUE_NAME), 
RoutingType.ANYCAST));
+      server.createQueue(new 
QueueConfiguration(NORMAL_QUEUE_NAME).setRoutingType(RoutingType.ANYCAST));
+   }
+
+   @Test
+   @Ignore // Qpid JMS client throws javax.jms.InvalidSelectorException: XPATH 
'root/a'

Review comment:
       If disabling the validation works, can remove all these ignores. 
Otherwise, removing the useless test would seem better.




----------------------------------------------------------------
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:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 556846)
    Time Spent: 1h 10m  (was: 1h)

> Support XPath filters
> ---------------------
>
>                 Key: ARTEMIS-3137
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-3137
>             Project: ActiveMQ Artemis
>          Issue Type: New Feature
>            Reporter: Justin Bertram
>            Assignee: Justin Bertram
>            Priority: Major
>          Time Spent: 1h 10m
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to