From 78ccd4bdddbdb56db260fd411d7a5c7795919e71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20G=C3=B6m=C3=B6ri?= Date: Thu, 16 May 2024 17:05:57 +0200 Subject: [PATCH 1/2] Use rabbitmq/bazel-central-registry@erlang-packages bzlmod registry recent versions of osiris are available from this registry --- .bazelrc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.bazelrc b/.bazelrc index 7bdfd90..4bd3cff 100644 --- a/.bazelrc +++ b/.bazelrc @@ -1,5 +1,7 @@ build --enable_bzlmod -# build --registry=https://raw.githubusercontent.com/rabbitmq/bazel-central-registry/dev/ + +build --registry=https://bcr.bazel.build/ +build --registry=https://raw.githubusercontent.com/rabbitmq/bazel-central-registry/erlang-packages/ build --incompatible_strict_action_env build --local_test_jobs=1 From 7cfc482133bf09150f61ae20a5a2fec9ddf73b90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20G=C3=B6m=C3=B6ri?= Date: Thu, 16 May 2024 18:48:21 +0200 Subject: [PATCH 2/2] Make plugin compatible with 3.13 Adjust to changes in rabbit_exchange_type behaviour --- MODULE.bazel | 2 +- Makefile | 5 +++-- README.md | 8 +++++--- helpers.bzl | 2 +- src/rabbit_exchange_type_rtopic.erl | 6 +++--- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/MODULE.bazel b/MODULE.bazel index 538a335..5ba5b6c 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -1,6 +1,6 @@ module( name = "rabbitmq_rtopic_exchange", - version = "3.11.4", + version = "3.13.0", ) bazel_dep( diff --git a/Makefile b/Makefile index 1f7b562..65486bf 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,10 @@ PROJECT = rabbitmq_rtopic_exchange PROJECT_DESCRIPTION = Reverse Topic Exchange Type -RABBITMQ_VERSION ?= v3.11.x +RABBITMQ_VERSION ?= v3.13.x +current_rmq_ref = $(RABBITMQ_VERSION) define PROJECT_APP_EXTRA_KEYS - {broker_version_requirements, ["3.11.0"]} + {broker_version_requirements, ["3.13.0"]} endef DEPS = rabbit_common rabbit diff --git a/README.md b/README.md index 6377c89..0f55d6b 100644 --- a/README.md +++ b/README.md @@ -51,11 +51,13 @@ The exchange type used when declaring an exchange is `x-rtopic`. ## Supported RabbitMQ Versions -The most recent release of this plugin targets RabbitMQ 3.12.x. +The most recent release of this plugin targets RabbitMQ 3.13.x. + +This plugin requires Mnesia and does not work with Khepri! ## Supported Erlang/OTP Versions -This plugin [requires Erlang 25.0 or later versions](https://www.rabbitmq.com/which-erlang.html), same as RabbitMQ 3.12.x. +This plugin [requires Erlang 26.0 or later versions](https://www.rabbitmq.com/which-erlang.html), same as RabbitMQ 3.13.x. ## Installation and Binary Builds @@ -116,7 +118,7 @@ If you have the needs for routing `"a0.#.c0.d0.#.f0.#"` then again, with a small 1. Update `broker_version_requirements` in `helpers.bzl` & `Makefile` (Optional) 1. Update the plugin version in `MODULE.bazel` -1. Push a tag (i.e. `v3.12.0`) with the matching version +1. Push a tag (i.e. `v3.13.0`) with the matching version 1. Allow the Release workflow to run and create a draft release 1. Review and publish the release diff --git a/helpers.bzl b/helpers.bzl index aaada7b..0308979 100644 --- a/helpers.bzl +++ b/helpers.bzl @@ -1,6 +1,6 @@ load("@rules_erlang//:ct.bzl", "ct_test") -BROKER_VERSION_REQUIREMENTS_TERM = """{broker_version_requirements, ["3.11.0"]}""" +BROKER_VERSION_REQUIREMENTS_TERM = """{broker_version_requirements, ["3.13.0"]}""" def rabbitmq_suite( name = None, diff --git a/src/rabbit_exchange_type_rtopic.erl b/src/rabbit_exchange_type_rtopic.erl index 3e25cee..d384f90 100644 --- a/src/rabbit_exchange_type_rtopic.erl +++ b/src/rabbit_exchange_type_rtopic.erl @@ -16,7 +16,7 @@ -behaviour(rabbit_exchange_type). --export([description/0, serialise_events/0, route/2]). +-export([description/0, serialise_events/0, route/3]). -export([validate/1, validate_binding/2, create/2, delete/2, policy_changed/2, add_binding/3, remove_bindings/3, assert_args_equivalence/2]). @@ -58,8 +58,8 @@ description() -> serialise_events() -> false. %% NB: This may return duplicate results in some situations (that's ok) -route(#exchange{name = X}, - #delivery{message = #basic_message{routing_keys = Routes}}) -> +route(#exchange{name = X}, Msg, _Opts) -> + Routes = mc:routing_keys(Msg), lists:append([begin Words = split_topic_key(RKey), mnesia:async_dirty(fun trie_match/2, [X, Words])