Skip to content
Draft
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
22 changes: 16 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ jobs:
- name: Setup .NET SDK
uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.x
dotnet-version: |
10.x
11.x
- name: Install dependencies
run: dotnet restore ${{ github.workspace }}/Source/EasyNetQ.Management.Client.slnx
- name: Check formatting
Expand All @@ -47,7 +49,9 @@ jobs:
matrix:
include:
- os: ubuntu-latest
framework: net8.0
framework: net10.0
- os: ubuntu-latest
framework: net11.0
- os: windows-latest
framework: net48
fail-fast: true
Expand All @@ -59,7 +63,9 @@ jobs:
- name: Setup .NET SDK
uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.x
dotnet-version: |
10.x
11.x
- name: Install dependencies
run: dotnet restore ${{ github.workspace }}/Source/EasyNetQ.Management.Client.slnx
- name: Build
Expand All @@ -82,7 +88,7 @@ jobs:
os: [ubuntu-latest]
include:
- os: ubuntu-latest
framework: net10.0
framework: net11.0
# - os: windows-latest
# framework: net48
fail-fast: true
Expand All @@ -94,7 +100,9 @@ jobs:
- name: Setup .NET SDK
uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.x
dotnet-version: |
10.x
11.x
- name: Install dependencies
run: dotnet restore ${{ github.workspace }}/Source/EasyNetQ.Management.Client.slnx
- name: Build
Expand All @@ -119,7 +127,9 @@ jobs:
- name: Setup .NET SDK
uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.x
dotnet-version: |
10.x
11.x
- name: Install dependencies
run: dotnet restore ${{ github.workspace }}/Source/EasyNetQ.Management.Client.slnx
- name: Build
Expand Down
Binary file removed Assets/EasyNetQ.snk
Binary file not shown.
44 changes: 37 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,43 @@

## EasyNetQ.Management.Client

EasyNetQ.Management.Client is a .NET client for the RabbitMQ Management API. This lets you control all aspects for your
RabbitMQ broker from .NET code, including creating virtual hosts and users; setting permissions; monitoring queues,
connections and channels; and setting up exchanges, queues and bindings.

See the **[documentation](https://github.com/EasyNetQ/EasyNetQ/wiki/Management-API-Introduction)**.

The announcement blog post is [here](http://mikehadlow.blogspot.co.uk/2012/11/a-c-net-client-proxy-for-rabbitmq.html)
A .NET client for the [RabbitMQ management HTTP API](https://www.rabbitmq.com/docs/management#http-api): create virtual
hosts, users and permissions; declare exchanges, queues, bindings and policies; monitor queues, connections, channels
and nodes; run health checks.

> **Built on [Refit](https://github.com/reactiveui/refit).** Since 4.0, `IManagementClient` is a Refit interface: each
> management endpoint is one annotated method, and Refit's source generator writes the HTTP requests at build time.
> JSON goes through a System.Text.Json source-generated context. No reflection at run time, so the client works in
> trimmed and **Native AOT** apps.

```shell
dotnet add package EasyNetQ.Management.Client
```

```csharp
using var client = new ManagementClient(new Uri("http://localhost:15672"), "guest", "guest");

var queues = await client.GetQueuesAsync("/");
await client.CreateQueueAsync("/", "orders", new QueueInfo(Arguments: new Dictionary<string, object?> { ["x-queue-type"] = "quorum" }));
var orders = await client.GetQueueAsync("/", "orders");
await client.PurgeAsync(orders);
```

- **Targets** .NET 10, .NET 11 and .NET Framework 4.8
- **Your own `HttpClient`**: `new ManagementClient(httpClient, user, password)` uses its `BaseAddress`, handlers and timeout, and leaves it open on dispose
- **Errors**: a failed call throws `UnexpectedHttpStatusCodeException` with the `StatusCode` and the response body
- **Overloads taking the model**: methods with a vhost, queue, exchange or user name also accept a `Vhost`, `QueueName`, `ExchangeName` or `User`
- **Testing**: depend on `IManagementClient` and mock it, or give `ManagementClient` an `HttpClient` with a fake handler

See the **[documentation](https://github.com/EasyNetQ/EasyNetQ/wiki/Management-Client-v4)**.

### Upgrading to 4.0

- Every call is async; the generated synchronous overloads are gone
- Classic queue mirroring, removed in RabbitMQ 4.0, is gone: `HaMode`, `HaParams`, the `ha-*` policy fields and `HaveAnyClassicQueuesWithoutSynchronisedMirrorsAsync`
- The raw `GetAsync`/`PutAsync`/`PostAsync`/`DeleteAsync` over `RelativePath` and the obsolete host-name constructor are gone; `Endpoint` is on `ManagementClient`
- A parameter's value is a `ParameterValue`; under Native AOT it must be a shovel or federation value, a string, number or bool
- The assembly is no longer strong-named

## Contributors

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
<LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>

<AssemblyOriginatorKeyFile>..\..\Assets\EasyNetQ.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<PublicSign>false</PublicSign>
</PropertyGroup>

<ItemGroup>
Expand Down
Loading
Loading