Skip to content

Commit 310e812

Browse files
authored
Merge pull request #14184 from rabbitmq/amqp-sql
Support AMQP SQL Filter Expressions
2 parents a43e2c5 + bc346c8 commit 310e812

17 files changed

+3311
-3160
lines changed

deps/amqp10_common/include/amqp10_filter.hrl

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,15 @@
44
%%
55
%% Copyright (c) 2007-2025 Broadcom. All Rights Reserved. The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. All rights reserved.
66

7-
%% A filter with this name contains a JMS message selector.
8-
%% We use the same name as sent by the Qpid JMS client in
9-
%% https://github.com/apache/qpid-jms/blob/2.7.0/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpSupport.java#L75
10-
-define(FILTER_NAME_JMS, <<"jms-selector">>).
11-
12-
%% A filter with this name contains an SQL expression.
13-
%% In the current version, such a filter must comply with the JMS message selector syntax.
14-
%% However, we use a name other than "jms-selector" in case we want to extend the allowed syntax
15-
%% in the future, for example allowing for some of the extended grammar described in
16-
%% §6 "SQL Filter Expressions" of
17-
%% https://groups.oasis-open.org/higherlogic/ws/public/document?document_id=66227
18-
-define(FILTER_NAME_SQL, <<"sql-filter">>).
19-
20-
%% SQL-based filtering syntax
21-
%% These descriptors are defined in
22-
%% https://www.amqp.org/specification/1.0/filters
23-
-define(DESCRIPTOR_NAME_SELECTOR_FILTER, <<"apache.org:selector-filter:string">>).
24-
-define(DESCRIPTOR_CODE_SELECTOR_FILTER, 16#0000468C00000004).
25-
26-
%% AMQP Filter Expressions Version 1.0 Working Draft 09
27-
%% https://groups.oasis-open.org/higherlogic/ws/public/document?document_id=66227
7+
%% AMQP Filter Expressions Version 1.0 Committee Specification Draft 01
8+
%% https://docs.oasis-open.org/amqp/filtex/v1.0/csd01/filtex-v1.0-csd01.html#_Toc67929266
289
-define(DESCRIPTOR_NAME_PROPERTIES_FILTER, <<"amqp:properties-filter">>).
2910
-define(DESCRIPTOR_CODE_PROPERTIES_FILTER, 16#173).
3011
-define(DESCRIPTOR_NAME_APPLICATION_PROPERTIES_FILTER, <<"amqp:application-properties-filter">>).
3112
-define(DESCRIPTOR_CODE_APPLICATION_PROPERTIES_FILTER, 16#174).
13+
14+
%% A filter with this name contains an AMQP SQL expression.
15+
-define(FILTER_NAME_SQL, <<"sql-filter">>).
16+
%% https://docs.oasis-open.org/amqp/filtex/v1.0/csd01/filtex-v1.0-csd01.html#_Toc67929276
17+
-define(DESCRIPTOR_NAME_SQL_FILTER, <<"amqp:sql-filter">>).
18+
-define(DESCRIPTOR_CODE_SQL_FILTER, 16#120).

deps/rabbit/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ define ct_master.erl
258258
endef
259259

260260
PARALLEL_CT_SET_1_A = unit_rabbit_ssl unit_cluster_formation_locking_mocks unit_cluster_formation_sort_nodes unit_collections unit_config_value_encryption unit_connection_tracking
261-
PARALLEL_CT_SET_1_B = amqp_address amqp_auth amqp_credit_api_v2 amqp_filter_prop amqp_filter_sql amqp_jms_unit amqp_dotnet amqp_jms signal_handling single_active_consumer unit_access_control_authn_authz_context_propagation unit_access_control_credential_validation unit_amqp091_content_framing unit_amqp091_server_properties unit_app_management
261+
PARALLEL_CT_SET_1_B = amqp_address amqp_auth amqp_credit_api_v2 amqp_filter_prop amqp_filter_sql amqp_filter_sql_unit amqp_dotnet amqp_jms signal_handling single_active_consumer unit_access_control_authn_authz_context_propagation unit_access_control_credential_validation unit_amqp091_content_framing unit_amqp091_server_properties unit_app_management
262262
PARALLEL_CT_SET_1_C = amqp_proxy_protocol amqpl_consumer_ack amqpl_direct_reply_to backing_queue bindings rabbit_db_maintenance rabbit_db_msup rabbit_db_policy rabbit_db_queue rabbit_db_topic_exchange rabbit_direct_reply_to_prop cluster_limit cluster_minority term_to_binary_compat_prop topic_permission transactions unicode unit_access_control
263263
PARALLEL_CT_SET_1_D = amqqueue_backward_compatibility channel_interceptor channel_operation_timeout classic_queue classic_queue_prop config_schema peer_discovery_dns peer_discovery_tmp_hidden_node per_node_limit per_user_connection_channel_limit
264264

deps/rabbit/src/rabbit_amqp_filter.erl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
-type expression() :: undefined |
1212
{property, rabbit_amqp_filter_prop:parsed_expressions()} |
13-
{jms, rabbit_amqp_filter_jms:parsed_expression()}.
13+
{sql, rabbit_amqp_filter_sql:parsed_expression()}.
1414

1515
-export_type([expression/0]).
1616

@@ -20,5 +20,5 @@ eval(undefined, _Mc) ->
2020
true;
2121
eval({property, Expr}, Mc) ->
2222
rabbit_amqp_filter_prop:eval(Expr, Mc);
23-
eval({jms, Expr}, Mc) ->
24-
rabbit_amqp_filter_jms:eval(Expr, Mc).
23+
eval({sql, Expr}, Mc) ->
24+
rabbit_amqp_filter_sql:eval(Expr, Mc).

0 commit comments

Comments
 (0)