Skip to content

Commit

Permalink
Allow to skip the dlk check
Browse files Browse the repository at this point in the history
  • Loading branch information
frnmjn committed Dec 5, 2024
1 parent dcf521f commit 4b501d0
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/amqp/helper.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@ defmodule Amqpx.Helper do
Helper functions
"""

require Logger

alias Amqpx.{Exchange, Queue}

@skip_dlk_check Application.compile_env(:amqpx, :skip_dlk_check, false)

def manager_supervisor_configuration(config) do
{Amqpx.Gen.ConnectionManager, %{connection_params: encrypt_password(config)}}
end
Expand Down Expand Up @@ -92,7 +96,14 @@ defmodule Amqpx.Helper do
end

def setup_dead_lettering(_channel, %{queue: dlq, exchange: "", routing_key: bad_dlq}) do
raise "If x-dead-letter-exchange is an empty string, x-dead-letter-routing-key should be '#{dlq}' instead of '#{bad_dlq}'"
case @skip_dlk_check do
false ->
raise "If x-dead-letter-exchange is an empty string, x-dead-letter-routing-key should be '#{dlq}' instead of '#{bad_dlq}'"

true ->
Logger.warn("If x-dead-letter-exchange is an empty string, x-dead-letter-routing-key should be '#{dlq}' instead of '#{bad_dlq}'")
:ok
end
end

def setup_dead_lettering(channel, %{queue: dlq, exchange: exchange, routing_key: routing_key}) do
Expand Down

0 comments on commit 4b501d0

Please sign in to comment.