Skip to content

Commit

Permalink
RabbitMQ 4.0 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
LoisSotoLopez committed Oct 1, 2024
1 parent d12fde5 commit 4f328ce
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -186,26 +186,21 @@ defmodule RabbitMQMessageDeduplication.Queue do
end

@impl :rabbit_backing_queue
def publish(message, properties, boolean, pid, flow,
def publish(message, properties, boolean, pid,
state = dqstate(queue_state: qs)) do
passthrough1(state) do
publish(message, properties, boolean, pid, flow, qs)
publish(message, properties, boolean, pid, qs)
end
end

@impl :rabbit_backing_queue
def batch_publish(batch, pid, flow, state = dqstate(queue_state: qs)) do
passthrough1(state, do: batch_publish(batch, pid, flow, qs))
end
end

# Optimization for cases in which the queue is empty and the message
# is delivered straight to the client. Acknowledgement is enabled.
@impl :rabbit_backing_queue
def publish_delivered(message, properties, pid, flow, state) do
def publish_delivered(message, properties, pid, state) do
dqstate(queue_state: qs) = state

{ack_tag, state} = passthrough2(state) do
publish_delivered(message, properties, pid, flow, qs)
publish_delivered(message, properties, pid, qs)
end

if dedup_queue?(state) do
Expand All @@ -217,17 +212,8 @@ defmodule RabbitMQMessageDeduplication.Queue do
end

@impl :rabbit_backing_queue
def batch_publish_delivered(batch, pid, flow, state) do
dqstate(queue_state: qs) = state

passthrough2(state) do
batch_publish_delivered(batch, pid, flow, qs)
end
end

@impl :rabbit_backing_queue
def discard(msg_id, pid, flow, state = dqstate(queue_state: qs)) do
passthrough1(state, do: discard(msg_id, pid, flow, qs))
def discard(msg_id, pid, state = dqstate(queue_state: qs)) do
passthrough1(state, do: discard(msg_id, pid, qs))
end

@impl :rabbit_backing_queue
Expand Down Expand Up @@ -354,13 +340,8 @@ defmodule RabbitMQMessageDeduplication.Queue do
end

@impl :rabbit_backing_queue
def set_ram_duration_target(duration, state = dqstate(queue_state: qs)) do
passthrough1(state, do: set_ram_duration_target(duration, qs))
end

@impl :rabbit_backing_queue
def ram_duration(state = dqstate(queue_state: qs)) do
passthrough2(state, do: ram_duration(qs))
def update_rates(state = dqstate(queue_state: qs)) do
passthrough1(state, do: update_rates(qs))
end

@impl :rabbit_backing_queue
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ defmodule RabbitMQ.MessageDeduplicationPlugin.Mixfile do
extra_applications: [:rabbit],
mod: {RabbitMQMessageDeduplication, []},
registered: [RabbitMQMessageDeduplication],
broker_version_requirements: ["3.13.0"]
broker_version_requirements: ["4.0.0"]
]
end

Expand Down

0 comments on commit 4f328ce

Please sign in to comment.