Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module(
name = "rabbitmq_delayed_message_exchange",
version = "3.13.0",
version = "4.0.0",
)

bazel_dep(
Expand All @@ -27,14 +27,14 @@ use_repo(

bazel_dep(
name = "rabbitmq-server",
version = "3.13.0",
version = "4.0.0",
)

archive_override(
module_name = "rabbitmq-server",
strip_prefix = "rabbitmq-server-main",
strip_prefix = "rabbitmq-server-4.0.x",
urls = [
"https://github.com/rabbitmq/rabbitmq-server/archive/refs/heads/main.zip",
"https://github.com/rabbitmq/rabbitmq-server/archive/refs/heads/v4.0.x.zip",
],
)

Expand Down
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ PROJECT = rabbitmq_delayed_message_exchange
PROJECT_DESCRIPTION = RabbitMQ Delayed Message Exchange
PROJECT_MOD = rabbit_delayed_message_app

RABBITMQ_VERSION ?= v3.13.x
RABBITMQ_VERSION ?= v4.0.x
current_rmq_ref = $(RABBITMQ_VERSION)

define PROJECT_APP_EXTRA_KEYS
{broker_version_requirements, ["3.13.0"]}
{broker_version_requirements, ["4.0.0"]}
endef

dep_amqp_client = git_rmq-subfolder rabbitmq-erlang-client $(RABBITMQ_VERSION)
Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@ of some kind.

## Supported RabbitMQ Versions

The most recent release of this plugin targets RabbitMQ 3.13.x.
The most recent release of this plugin targets RabbitMQ 4.0.x.

This plugin currently only supports Mnesia for metadata store (do not use it with Khepri).

## Supported Erlang/OTP Versions

The latest version of this plugin [requires Erlang 26.0 or later versions](https://www.rabbitmq.com/which-erlang.html), same as RabbitMQ 3.13.x.
The latest version of this plugin [requires Erlang 26.2 or later versions](https://www.rabbitmq.com/which-erlang.html), same as RabbitMQ 4.0.x.

## Project Maturity

Expand Down Expand Up @@ -199,7 +201,7 @@ The EZ file is created in the `bazel-bin` directory.

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.13.0`) with the matching version
1. Push a tag (i.e. `v4.0.0`) with the matching version
1. Allow the Release workflow to run and create a draft release
1. Review and publish the release

Expand Down
2 changes: 1 addition & 1 deletion helpers.bzl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
load("@rules_erlang//:ct.bzl", "ct_test")

BROKER_VERSION_REQUIREMENTS_TERM = """{broker_version_requirements, ["3.13.0"]}"""
BROKER_VERSION_REQUIREMENTS_TERM = """{broker_version_requirements, ["4.0.0"]}"""

def rabbitmq_suite(
name = None,
Expand Down
61 changes: 24 additions & 37 deletions rabbitmq-components.mk
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ endif
PROJECT_VERSION := $(RABBITMQ_VERSION)

ifeq ($(PROJECT_VERSION),)
PROJECT_VERSION := $(shell \
PROJECT_VERSION = $(shell \
if test -f git-revisions.txt; then \
head -n1 git-revisions.txt | \
awk '{print $$$(words $(PROJECT_DESCRIPTION) version);}'; \
Expand Down Expand Up @@ -62,6 +62,7 @@ dep_rabbitmq_dotnet_client = git_rmq rabbitmq-dotnet-client
dep_rabbitmq_event_exchange = git_rmq-subfolder rabbitmq-event-exchange $(current_rmq_ref) $(base_rmq_ref) main
dep_rabbitmq_federation = git_rmq-subfolder rabbitmq-federation $(current_rmq_ref) $(base_rmq_ref) main
dep_rabbitmq_federation_management = git_rmq-subfolder rabbitmq-federation-management $(current_rmq_ref) $(base_rmq_ref) main
dep_rabbitmq_federation_prometheus = git_rmq-subfolder rabbitmq-federation-prometheus $(current_rmq_ref) $(base_rmq_ref) main
dep_rabbitmq_java_client = git_rmq rabbitmq-java-client $(current_rmq_ref) $(base_rmq_ref) main
dep_rabbitmq_jms_client = git_rmq rabbitmq-jms-client $(current_rmq_ref) $(base_rmq_ref) main
dep_rabbitmq_jms_cts = git_rmq rabbitmq-jms-cts $(current_rmq_ref) $(base_rmq_ref) main
Expand Down Expand Up @@ -89,6 +90,7 @@ dep_rabbitmq_rtopic_exchange = git_rmq rabbitmq-rtopic-exchan
dep_rabbitmq_sharding = git_rmq-subfolder rabbitmq-sharding $(current_rmq_ref) $(base_rmq_ref) main
dep_rabbitmq_shovel = git_rmq-subfolder rabbitmq-shovel $(current_rmq_ref) $(base_rmq_ref) main
dep_rabbitmq_shovel_management = git_rmq-subfolder rabbitmq-shovel-management $(current_rmq_ref) $(base_rmq_ref) main
dep_rabbitmq_shovel_prometheus = git_rmq-subfolder rabbitmq-shovel-prometheus $(current_rmq_ref) $(base_rmq_ref) main
dep_rabbitmq_stomp = git_rmq-subfolder rabbitmq-stomp $(current_rmq_ref) $(base_rmq_ref) main
dep_rabbitmq_stream = git_rmq-subfolder rabbitmq-stream $(current_rmq_ref) $(base_rmq_ref) main
dep_rabbitmq_stream_common = git_rmq-subfolder rabbitmq-stream-common $(current_rmq_ref) $(base_rmq_ref) main
Expand All @@ -108,24 +110,26 @@ dep_toke = git_rmq toke $(current_rmq_ref

# Third-party dependencies version pinning.
#
# We do that in this file, which is copied in all projects, to ensure
# all projects use the same versions. It avoids conflicts and makes it
# possible to work with rabbitmq-public-umbrella.
# We do that in this file, which is included by all projects, to ensure
# all projects use the same versions. It avoids conflicts.

dep_accept = hex 0.3.5
dep_cowboy = hex 2.11.0
dep_cowlib = hex 2.12.1
dep_cowboy = hex 2.12.0
dep_cowlib = hex 2.13.0
dep_credentials_obfuscation = hex 3.4.0
dep_khepri = hex 0.12.1
dep_khepri_mnesia_migration = hex 0.4.0
dep_looking_glass = git https://github.com/rabbitmq/looking_glass.git main
dep_cuttlefish = hex 3.4.0
dep_gen_batch_server = hex 0.8.8
dep_jose = hex 1.11.10
dep_khepri = hex 0.16.0
dep_khepri_mnesia_migration = hex 0.7.0
dep_prometheus = hex 4.11.0
dep_ra = hex 2.9.1
dep_ra = hex 2.14.0
dep_ranch = hex 2.1.0
dep_recon = hex 2.5.3
dep_redbug = hex 2.0.7
dep_thoas = hex 1.0.0
dep_observer_cli = hex 1.7.3
dep_observer_cli = hex 1.7.5
dep_seshat = git https://github.com/rabbitmq/seshat v0.6.1
dep_stdout_formatter = hex 0.2.4
dep_sysmon_handler = hex 1.3.0

Expand Down Expand Up @@ -154,6 +158,7 @@ RABBITMQ_COMPONENTS = amqp_client \
rabbitmq_event_exchange \
rabbitmq_federation \
rabbitmq_federation_management \
rabbitmq_federation_prometheus \
rabbitmq_java_client \
rabbitmq_jms_client \
rabbitmq_jms_cts \
Expand Down Expand Up @@ -181,6 +186,7 @@ RABBITMQ_COMPONENTS = amqp_client \
rabbitmq_sharding \
rabbitmq_shovel \
rabbitmq_shovel_management \
rabbitmq_shovel_prometheus \
rabbitmq_stomp \
rabbitmq_stream \
rabbitmq_stream_common \
Expand Down Expand Up @@ -348,38 +354,19 @@ prepare-dist::
@:

# --------------------------------------------------------------------
# Umbrella-specific settings.
# Monorepo-specific settings.
# --------------------------------------------------------------------

# If the top-level project is a RabbitMQ component, we override
# $(DEPS_DIR) for this project to point to the top-level's one.
#
# We also verify that the guessed DEPS_DIR is actually named `deps`,
# to rule out any situation where it is a coincidence that we found a
# `rabbitmq-components.mk` up upper directories.
# We do the same for $(ERLANG_MK_TMP) as we want to keep the
# beam cache regardless of where we build. We also want to
# share Hex tarballs.

possible_deps_dir_1 = $(abspath ..)
possible_deps_dir_2 = $(abspath ../../..)

ifeq ($(notdir $(possible_deps_dir_1)),deps)
ifneq ($(wildcard $(possible_deps_dir_1)/../rabbitmq-components.mk),)
deps_dir_overriden = 1
DEPS_DIR ?= $(possible_deps_dir_1)
DISABLE_DISTCLEAN = 1
endif
endif

ifeq ($(deps_dir_overriden),)
ifeq ($(notdir $(possible_deps_dir_2)),deps)
ifneq ($(wildcard $(possible_deps_dir_2)/../rabbitmq-components.mk),)
deps_dir_overriden = 1
DEPS_DIR ?= $(possible_deps_dir_2)
DISABLE_DISTCLEAN = 1
endif
endif
endif

ifneq ($(wildcard UMBRELLA.md),)
ifneq ($(PROJECT),rabbitmq_server_release)
DEPS_DIR ?= $(abspath ..)
ERLANG_MK_TMP ?= $(abspath ../../.erlang.mk)
DISABLE_DISTCLEAN = 1
endif

Expand Down
45 changes: 16 additions & 29 deletions src/rabbit_delayed_message.erl
Original file line number Diff line number Diff line change
Expand Up @@ -238,42 +238,29 @@ recover() ->
%% consistent hash exchanges since plugin activation was moved later in boot process
%% starting with RabbitMQ 3.8.4
case list_exchanges() of
{ok, Xs} ->
{error, Reason} ->
rabbit_log:error(
"Delayed message exchange: "
"failed to recover durable bindings of one of the exchanges, reason: ~p",
[Reason]);
Xs ->
rabbit_log:debug("Delayed message exchange: "
"have ~b durable exchanges to recover",
"have ~b durable exchanges to recover",
[length(Xs)]),
[recover_exchange_and_bindings(X) || X <- lists:usort(Xs)];
{aborted, Reason} ->
rabbit_log:error(
"Delayed message exchange: "
"failed to recover durable bindings of one of the exchanges, reason: ~p",
[Reason])
[recover_exchange_and_bindings(X) || X <- lists:usort(Xs)]
end.

list_exchanges() ->
case mnesia:transaction(
fun () ->
mnesia:match_object(
rabbit_exchange, #exchange{durable = true,
type = 'x-delayed-message',
_ = '_'}, write)
end) of
{atomic, Xs} ->
{ok, Xs};
{aborted, Reason} ->
{aborted, Reason}
end.
Pattern = #exchange{durable = true, type = 'x-delayed-message', _ = '_'},
rabbit_db_exchange:match(Pattern).

recover_exchange_and_bindings(#exchange{name = XName} = X) ->
mnesia:transaction(
fun () ->
Bindings = rabbit_binding:list_for_source(XName),
_ = [rabbit_exchange_type_delayed_message:add_binding(transaction, X, B)
|| B <- lists:usort(Bindings)],
rabbit_log:debug("Delayed message exchange: "
"recovered bindings for ~s",
[rabbit_misc:rs(XName)])
end).
Bindings = rabbit_binding:list_for_source(XName),
_ = [rabbit_exchange_type_delayed_message:add_binding(none, X, B)
|| B <- lists:usort(Bindings)],
rabbit_log:debug("Delayed message exchange: "
"recovered bindings for ~s",
[rabbit_misc:rs(XName)]).

%% These metrics are normally bumped from a channel process via which
%% the publish actually happened. In the special case of delayed
Expand Down
Loading