Skip to content

Commit

Permalink
Update rabbit libraries to 4.0 (#216)
Browse files Browse the repository at this point in the history
  • Loading branch information
MaeIsBad authored Jan 7, 2025
1 parent b4a9acc commit fd9cf72
Show file tree
Hide file tree
Showing 14 changed files with 36 additions and 23 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ jobs:
- name: Setup Elixir
uses: erlef/setup-beam@v1
with:
otp-version: "25"
elixir-version: "1.14"
otp-version: "26"
elixir-version: "1.16"
- name: Checkout
uses: actions/checkout@v3
- name: setup hex
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
steps:
- uses: erlef/setup-beam@v1
with:
elixir-version: 1.14
otp-version: 25
elixir-version: 1.16
otp-version: 26

# Check out the code.
- name: Checkout
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/retire.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ jobs:
- uses: actions/checkout@v4
- uses: erlef/setup-beam@v1
with:
otp-version: "25"
elixir-version: "1.14"
otp-version: "26"
elixir-version: "1.16"
- run: echo "Attempting to retire version $VERSION"
- run: mix hex.config api_key "$HEX_AUTH_KEY"
env:
Expand Down
4 changes: 2 additions & 2 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
erlang 25.3.2.8
elixir 1.14.5-otp-25
erlang 26.2.5.3
elixir 1.16.3-otp-26
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ and this project adheres to

## [Unreleased]

### Updated

- rabbit libraries to `amqp_client` and `rabbit_common` to 4.0

- Increased minimum supported elixir version to 1.16, otp 26

This is due to elixir rabbit not supporting the older versions of the libraries

---

## [6.1.2] - 2024-12-02
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM public.ecr.aws/prima/elixir:1.14.2-5
FROM public.ecr.aws/prima/elixir:1.16.3

WORKDIR /code

Expand Down
2 changes: 1 addition & 1 deletion lib/amqp/gen/connection_manager.ex
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ defmodule Amqpx.Gen.ConnectionManager do
end

def handle_info(message, state) do
Logger.warn("Unknown message received #{inspect(message)}")
Logger.warning("Unknown message received #{inspect(message)}")
{:noreply, state}
end

Expand Down
2 changes: 1 addition & 1 deletion lib/amqp/gen/consumer.ex
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ defmodule Amqpx.Gen.Consumer do
def handle_info({:EXIT, _, :normal}, state), do: {:noreply, state}

def handle_info(message, state) do
Logger.warn("Unknown message received #{inspect(message)}")
Logger.warning("Unknown message received #{inspect(message)}")
{:noreply, state}
end

Expand Down
4 changes: 2 additions & 2 deletions lib/amqp/gen/producer.ex
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ defmodule Amqpx.Gen.Producer do

# Public API

@spec start_link(opts :: map()) :: GenServer.server()
@spec start_link(opts :: map()) :: GenServer.on_start()
def start_link(opts) do
gen_server_opts =
opts
Expand Down Expand Up @@ -129,7 +129,7 @@ defmodule Amqpx.Gen.Producer do
def handle_info({:EXIT, _, :normal}, state), do: {:noreply, state}

def handle_info(message, state) do
Logger.warn("Unknown message received #{inspect(message)}")
Logger.warning("Unknown message received #{inspect(message)}")
{:noreply, state}
end

Expand Down
2 changes: 1 addition & 1 deletion lib/amqp/helper.ex
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ defmodule Amqpx.Helper do
"If x-dead-letter-exchange is an empty string, x-dead-letter-routing-key should be '#{dlq}' instead of '#{bad_dlq}'"

if Enum.member?(skip_dead_letter_routing_key_check_for(), bad_dlq) do
Logger.warn(msg)
Logger.warning(msg)
else
raise msg
end
Expand Down
6 changes: 3 additions & 3 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ defmodule Amqpx.MixProject do
app: :amqpx,
name: "amqpx",
version: "6.1.2",
elixir: "~> 1.14",
elixir: "~> 1.16",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :production,
deps: deps(),
Expand Down Expand Up @@ -51,8 +51,8 @@ defmodule Amqpx.MixProject do
# Run "mix help deps" to learn about dependencies.
defp deps do
[
{:amqp_client, "~> 3.9"},
{:rabbit_common, "~> 3.9"},
{:amqp_client, "~> 4.0"},
{:rabbit_common, "~> 4.0"},
{:elixir_uuid, "~> 1.2"},
{:credo, "~> 1.5", only: [:dev, :test, :gha]},
{:mock, "~> 0.3.7", only: [:test, :gha]},
Expand Down
9 changes: 5 additions & 4 deletions mix.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
%{
"amqp_client": {:hex, :amqp_client, "3.12.14", "2b677bc3f2e2234ba7517042b25d72071a79735042e91f9116bd3c176854b622", [:make, :rebar3], [{:credentials_obfuscation, "3.4.0", [hex: :credentials_obfuscation, repo: "hexpm", optional: false]}, {:rabbit_common, "3.12.14", [hex: :rabbit_common, repo: "hexpm", optional: false]}], "hexpm", "5f70b6c3b1a739790080da4fddc94a867e99f033c4b1edc20d6ff8b8fb4bd160"},
"amqp_client": {:hex, :amqp_client, "4.0.3", "c7dcc8031c780cd39ec586ba827a8eb26e006e9761af8d3f58fded11f645ebd4", [:make, :rebar3], [{:credentials_obfuscation, "3.4.0", [hex: :credentials_obfuscation, repo: "hexpm", optional: false]}, {:rabbit_common, "4.0.3", [hex: :rabbit_common, repo: "hexpm", optional: false]}], "hexpm", "ae945f7280617e9a4b17a6d49e3a2f496d716e8088ec29d8e94ecc79e5da7458"},
"bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"},
"credentials_obfuscation": {:hex, :credentials_obfuscation, "3.4.0", "34e18b126b3aefd6e8143776fbe1ceceea6792307c99ac5ee8687911f048cfd7", [:rebar3], [], "hexpm", "738ace0ed5545d2710d3f7383906fc6f6b582d019036e5269c4dbd85dbced566"},
"credo": {:hex, :credo, "1.7.11", "d3e805f7ddf6c9c854fd36f089649d7cf6ba74c42bc3795d587814e3c9847102", [:mix], [{:bunt, "~> 0.2.1 or ~> 1.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "56826b4306843253a66e47ae45e98e7d284ee1f95d53d1612bb483f88a8cf219"},
Expand All @@ -16,7 +16,8 @@
"meck": {:hex, :meck, "0.9.2", "85ccbab053f1db86c7ca240e9fc718170ee5bda03810a6292b5306bf31bae5f5", [:rebar3], [], "hexpm", "81344f561357dc40a8344afa53767c32669153355b626ea9fcbc8da6b3045826"},
"mock": {:hex, :mock, "0.3.9", "10e44ad1f5962480c5c9b9fa779c6c63de9bd31997c8e04a853ec990a9d841af", [:mix], [{:meck, "~> 0.9.2", [hex: :meck, repo: "hexpm", optional: false]}], "hexpm", "9e1b244c4ca2551bb17bb8415eed89e40ee1308e0fbaed0a4fdfe3ec8a4adbd3"},
"nimble_parsec": {:hex, :nimble_parsec, "1.4.0", "51f9b613ea62cfa97b25ccc2c1b4216e81df970acd8e16e8d1bdc58fef21370d", [:mix], [], "hexpm", "9c565862810fb383e9838c1dd2d7d2c437b3d13b267414ba6af33e50d2d1cf28"},
"rabbit_common": {:hex, :rabbit_common, "3.12.14", "466123ee7346a3cdac078c0c302bcd36da4523e8acd678c1b992f7b4df1f7914", [:make, :rebar3], [{:credentials_obfuscation, "3.4.0", [hex: :credentials_obfuscation, repo: "hexpm", optional: false]}, {:recon, "2.5.3", [hex: :recon, repo: "hexpm", optional: false]}, {:thoas, "1.0.0", [hex: :thoas, repo: "hexpm", optional: false]}], "hexpm", "70c31a51f7401cc0204ddef2745d98680c2e0df67e3b0c9e198916881fde3293"},
"recon": {:hex, :recon, "2.5.3", "739107b9050ea683c30e96de050bc59248fd27ec147696f79a8797ff9fa17153", [:mix, :rebar3], [], "hexpm", "6c6683f46fd4a1dfd98404b9f78dcabc7fcd8826613a89dcb984727a8c3099d7"},
"thoas": {:hex, :thoas, "1.0.0", "567c03902920827a18a89f05b79a37b5bf93553154b883e0131801600cf02ce0", [:rebar3], [], "hexpm", "fc763185b932ecb32a554fb735ee03c3b6b1b31366077a2427d2a97f3bd26735"},
"rabbit_common": {:hex, :rabbit_common, "4.0.3", "e927b882733d122f6802662220bdb1a83774852dbe67d21d4e33aaf54f3998dd", [:make, :rebar3], [{:credentials_obfuscation, "3.4.0", [hex: :credentials_obfuscation, repo: "hexpm", optional: false]}, {:ranch, "2.1.0", [hex: :ranch, repo: "hexpm", optional: false]}, {:recon, "2.5.6", [hex: :recon, repo: "hexpm", optional: false]}, {:thoas, "1.2.1", [hex: :thoas, repo: "hexpm", optional: false]}], "hexpm", "ead31ba292c2cc5fda48a486417d7cfe8966f661994d7ed6c3e5f8840828e8ec"},
"ranch": {:hex, :ranch, "2.1.0", "2261f9ed9574dcfcc444106b9f6da155e6e540b2f82ba3d42b339b93673b72a3", [:make, :rebar3], [], "hexpm", "244ee3fa2a6175270d8e1fc59024fd9dbc76294a321057de8f803b1479e76916"},
"recon": {:hex, :recon, "2.5.6", "9052588e83bfedfd9b72e1034532aee2a5369d9d9343b61aeb7fbce761010741", [:mix, :rebar3], [], "hexpm", "96c6799792d735cc0f0fd0f86267e9d351e63339cbe03df9d162010cefc26bb0"},
"thoas": {:hex, :thoas, "1.2.1", "19a25f31177a17e74004d4840f66d791d4298c5738790fa2cc73731eb911f195", [:rebar3], [], "hexpm", "e38697edffd6e91bd12cea41b155115282630075c2a727e7a6b2947f5408b86a"},
}
4 changes: 2 additions & 2 deletions test/connection_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ defmodule ConnectionTest do

@obfuscate_password false

@invalid_ip '192.168.1.1'
@valid_ip '192.168.1.2'
@invalid_ip ~c"192.168.1.1"
@valid_ip ~c"192.168.1.2"

@open_options [
username: "amqpx",
Expand Down
4 changes: 4 additions & 0 deletions test/gen_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,8 @@ defmodule Amqpx.Test.AmqpxTest do

describe "configuration validation" do
test "if retry_policy is configured, max_retries must be > 0" do
Process.flag(:trap_exit, true)

assert {:error, {:invalid_configuration, "when retry policy is configured, max_retries must be > 0"}} =
Amqpx.Gen.Producer.start_link(%{
name: :producer_misconfigured_retry_policy_max_retries,
Expand All @@ -471,6 +473,8 @@ defmodule Amqpx.Test.AmqpxTest do
end

test "if retry_policy is configured, max_retries must be set" do
Process.flag(:trap_exit, true)

assert {:error, {:invalid_configuration, "when retry policy is configured, max_retries must be > 0"}} =
Amqpx.Gen.Producer.start_link(%{
name: :producer_misconfigured_retry_policy_max_retries,
Expand Down

0 comments on commit fd9cf72

Please sign in to comment.