Skip to content

Commit

Permalink
[DEVEX-2418]: Helper is mandatory since 6.1.2 (#217)
Browse files Browse the repository at this point in the history
* fix: remove Amqpx.SignalHandler from consumers_supervisor_configuration

* chore: bump to 6.1.3

---------

Co-authored-by: Cristiano Piemontese <[email protected]>
  • Loading branch information
emilianobovetti and cpiemontese authored Jan 23, 2025
1 parent fd9cf72 commit f4f675a
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 18 deletions.
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ and this project adheres to

## [Unreleased]

---

## [6.1.3] - 2025-01-23

### Fixed

- Elixir applications are no more forced to start `Amqpx.SignalHandler` manually

### Updated

- rabbit libraries to `amqp_client` and `rabbit_common` to 4.0
Expand Down Expand Up @@ -105,7 +113,9 @@ This is due to elixir rabbit not supporting the older versions of the libraries
- ([#129](https://github.com/primait/amqpx/pull/)) Default binding for DLX
queues instead of wildcard

[Unreleased]: https://github.com/primait/amqpx/compare/6.1.2...HEAD

[Unreleased]: https://github.com/primait/amqpx/compare/6.1.3...HEAD
[6.1.3]: https://github.com/primait/amqpx/compare/6.1.2...6.1.3
[6.1.2]: https://github.com/primait/amqpx/compare/6.1.1...6.1.2
[6.1.1]: https://github.com/primait/amqpx/compare/6.1.0...6.1.1
[6.1.0]: https://github.com/primait/amqpx/compare/6.0.4...6.1.0
Expand Down
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,18 @@
## About

A simple Amqp library based on
[official elixir amqp client](https://hex.pm/packages/amqp) Written to prevent
duplicated and boilerplate code to handle all the lifecycle of the amqp
connection. Write your publisher or consumer and forget about the rest!
[official elixir amqp client](https://hex.pm/packages/amqp).

Written to prevent duplicated and boilerplate code to handle all the lifecycle
of the amqp connection. Write your publisher or consumer and forget about the
rest!

## Installation

```elixir
def deps do
[
{:amqpx, "~> 6.0.2"}
{:amqpx, "~> 6.1.3"}
]
end
```
Expand Down Expand Up @@ -250,12 +252,15 @@ end

### Test suite

In order to run the test suite, you need to startup the docker compose and jump into it with:
In order to run the test suite, you need to startup the docker compose and jump
into it with:

```
docker compose run --service-ports console bash
```

and run the test suite with:

```
mix test
```
17 changes: 17 additions & 0 deletions catalog-info.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: backstage.io/v1alpha1
kind: Component
spec:
type: service
lifecycle: production
owner: team-developer-experience
system: prima.it
dependsOn: []
metadata:
name: amqpx
description: Elixir AMQP client
tags:
- elixir
- rabbitmq
links: []
# annotations:
# backstage.io/techdocs-ref: dir:.
16 changes: 16 additions & 0 deletions lib/amqp/application.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
defmodule Amqpx.Application do
@moduledoc false
use Application

def start(_type, _args) do
children = [
%{
id: Amqpx.SignalHandler,
start: {Amqpx.SignalHandler, :start_link, []}
}
]

opts = [strategy: :one_for_one, name: Amqpx.Supervisor]
Supervisor.start_link(children, opts)
end
end
11 changes: 1 addition & 10 deletions lib/amqp/helper.ex
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ defmodule Amqpx.Helper do
end

def consumers_supervisor_configuration(handlers_conf) do
amqp_signal_handler() ++
Enum.map(handlers_conf, &Supervisor.child_spec({Amqpx.Gen.Consumer, &1}, id: UUID.uuid1()))
Enum.map(handlers_conf, &Supervisor.child_spec({Amqpx.Gen.Consumer, &1}, id: UUID.uuid1()))
end

def producer_supervisor_configuration(producer_conf) do
Expand Down Expand Up @@ -190,14 +189,6 @@ defmodule Amqpx.Helper do
Exchange.declare(channel, name, type)
end

defp amqp_signal_handler,
do: [
%{
id: Amqpx.SignalHandler,
start: {Amqpx.SignalHandler, :start_link, []}
}
]

defp skip_dead_letter_routing_key_check_for,
do: Application.get_env(:amqpx, :skip_dead_letter_routing_key_check_for, [])
end
7 changes: 5 additions & 2 deletions mix.exs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
defmodule Amqpx.MixProject do
use Mix.Project

@version "6.1.3"

def project do
[
app: :amqpx,
name: "amqpx",
version: "6.1.2",
version: @version,
elixir: "~> 1.16",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :production,
Expand All @@ -25,7 +27,8 @@ defmodule Amqpx.MixProject do
# Run "mix help compile.app" to learn about applications.
def application do
[
extra_applications: [:logger]
extra_applications: [:logger],
mod: {Amqpx.Application, []}
]
end

Expand Down

0 comments on commit f4f675a

Please sign in to comment.