You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/user-manual/filter-expressions.adoc
+18-11Lines changed: 18 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -57,24 +57,31 @@ The value is an integer.
57
57
58
58
Any other identifiers used in core filter expressions will be assumed to be properties of the message.
59
59
60
-
The JMS and Jakarta Messaging specs state that a String property should not get converted to a numeric when used in a selector.
61
-
So for example, if a message has the `age` property set to `String``21` then the following selector should not match it: `age > 18`.
62
-
STOMP clients, for example, can only send messages with string properties, which is a bit limiting.
63
-
Therefore, if you want your filter expressions to auto-convert `String` properties to the appropriate number type, just prefix it with `convert_string_expressions:`.
64
-
If you changed the filter expression in the previous example to be `convert_string_expressions:age > 18`, then it would match the aforementioned message.
60
+
== Property Identifier Constraints
65
61
66
-
The JMS and Jakarta Messaging specs also state that property identifiers (and therefore the identifiers which are valid for use in a filter expression) are an:
62
+
The JMS and Jakarta Messaging specs state that property identifiers (and therefore the identifiers which are valid for use in a filter expression) are an:
67
63
68
64
____
69
65
unlimited-length sequence of letters and digits, the first of which must be a letter.
70
-
A letter is any character for which the method `Character.isJavaLetter` returns `true`.
66
+
A letter is any character for which the method https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Character.html#isJavaLetter(char)[`Character.isJavaLetter`] returns `true`.
71
67
This includes `_` and `$`.
72
-
A letter or digit is any character for which the method `Character.isJavaLetterOrDigit` returns `true`.
68
+
A letter or digit is any character for which the method https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Character.html#isJavaLetterOrDigit(char)[`Character.isJavaLetterOrDigit`] returns `true`.
73
69
____
74
70
75
-
This constraint means that hyphens (i.e. `-`) cannot be used.
76
-
However, this constraint can be overcome by using the `hyphenated_props:` prefix.
77
-
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.
71
+
=== Working Around These Constraints
72
+
73
+
These constraints mean that characters like `.` (dot) and `-` (hyphen) cannot be used within property identifiers.
74
+
However, if you want to work around these constraints, you can surround the identifier with quotation marks in the filter expression.
75
+
For example, if a message had a property named `foo-bar` set to `0` then the filter expression `"foo-bar" = 0` would match it, whereas `foo-bar = 0` would *not* match.
76
+
77
+
== Property Value Conversion
78
+
79
+
The JMS and Jakarta Messaging specs also state that a `String` property should not get converted to a numeric value when used in a selector.
80
+
So for example, if a message has the `age` property set to the `String` "21" then the following selector should not match it: `age > 18`.
81
+
82
+
However, some protocols (e.g. STOMP) can only send messages with `String` properties, which is a bit limiting.
83
+
Therefore, if you want your filter expressions to auto-convert `String` properties to the appropriate number type, just prefix it with `convert_string_expressions:`.
84
+
If you changed the filter expression in the previous example to be `convert_string_expressions:age > 18`, then it would match the aforementioned message.
0 commit comments