|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Commands |
| 6 | + |
| 7 | +### Build |
| 8 | +```bash |
| 9 | +dotnet build ActiveMQ.Artemis.Client.sln |
| 10 | +``` |
| 11 | + |
| 12 | +### Unit Tests (no broker required) |
| 13 | +```bash |
| 14 | +dotnet test --filter "FullyQualifiedName!~IntegrationTests" |
| 15 | +``` |
| 16 | + |
| 17 | +### Integration Tests (requires broker) |
| 18 | +Start the broker first: |
| 19 | +```bash |
| 20 | +cd test/artemis && docker-compose up -V -d |
| 21 | +``` |
| 22 | + |
| 23 | +Then run: |
| 24 | +```bash |
| 25 | +dotnet test --filter "FullyQualifiedName~IntegrationTests" |
| 26 | +``` |
| 27 | + |
| 28 | +Run a single test class: |
| 29 | +```bash |
| 30 | +dotnet test --filter "FullyQualifiedName~FilterExpressionsSpec" |
| 31 | +``` |
| 32 | + |
| 33 | +### Integration Test Configuration |
| 34 | +The broker endpoint is resolved from environment variables with these defaults: |
| 35 | +- `ARTEMIS_HOST` → `localhost` |
| 36 | +- `ARTEMIS_PORT` → `5672` |
| 37 | +- `ARTEMIS_USERNAME` → `artemis` |
| 38 | +- `ARTEMIS_PASSWORD` → `artemis` |
| 39 | + |
| 40 | +## Architecture |
| 41 | + |
| 42 | +### Core Library (`src/ArtemisNetClient`) |
| 43 | + |
| 44 | +Built on top of [AmqpNetLite](http://azure.github.io/amqpnetlite/). The public API surface is: |
| 45 | +- `ConnectionFactory` — entry point; configures recovery policy, message ID policy, TLS, TCP settings |
| 46 | +- `IConnection` — creates producers, consumers, topology managers, request-reply clients |
| 47 | +- `IProducer` / `IAnonymousProducer` — sends messages to a named address or any address |
| 48 | +- `IConsumer` — receives messages with optional `FilterExpression` |
| 49 | +- `IRequestReplyClient` — request-reply over AMQP |
| 50 | +- `ITopologyManager` — creates/declares/removes addresses and queues |
| 51 | + |
| 52 | +**Auto-recovery** (`AutoRecovering/`) wraps every public interface with a decorator that transparently reconnects and re-establishes links on broker disconnection. The recovery loop runs in a background `Task` per connection and coordinates via an unbounded `Channel<ConnectCommand>`. |
| 53 | + |
| 54 | +**Message model** (`Message/`) maps cleanly to AMQP sections: `Properties`, `Header`, `ApplicationProperties`, `MessageAnnotations`. Filter expressions use JMS-selector/SQL-92 syntax and operate on `ApplicationProperties` and predefined AMQP identifiers (`AMQPriority`, `AMQExpiration`, `AMQDurable`, `AMQTimestamp`). String comparisons in filters are case-sensitive. |
| 55 | + |
| 56 | +### Extensions |
| 57 | + |
| 58 | +| Package | Purpose | |
| 59 | +|---|---| |
| 60 | +| `ArtemisNetClient.Extensions.DependencyInjection` | `IServiceCollection` integration; typed producers/consumers as hosted services | |
| 61 | +| `ArtemisNetClient.Extensions.Hosting` | `IHostedService` wrappers | |
| 62 | +| `ArtemisNetClient.Extensions.App.Metrics` | App.Metrics instrumentation | |
| 63 | +| `ArtemisNetClient.Extensions.CloudEvents` | CloudEvents encoding/decoding on messages | |
| 64 | +| `ArtemisNetClient.Extensions.LeaderElection` | Distributed leader election via durable queues | |
| 65 | + |
| 66 | +### Test Kit (`src/ArtemisNetClient.Testing`) |
| 67 | + |
| 68 | +`TestKit` spins up an in-process AMQP broker (via AmqpNetLite's `ContainerHost`) for unit testing messaging logic without a real broker. It supports filter expressions, shared message sources, and transactions. Use `TestKit` for fast unit tests; use the Docker broker for integration tests that verify real Artemis behavior. |
| 69 | + |
| 70 | +### Test Projects |
| 71 | + |
| 72 | +- `ArtemisNetClient.UnitTests` / `ArtemisNetClient.Testing.UnitTests` — pure unit tests, no broker |
| 73 | +- `ArtemisNetClient.IntegrationTests` — tests against real Artemis; base class is `ActiveMQNetIntegrationSpec` |
| 74 | +- `ArtemisNetClient.Extensions.IntegrationTests` / others — extension-specific integration tests |
| 75 | +- `ArtemisNetClient.TestUtils` — shared helpers (`EndpointUtil`, test loggers) |
| 76 | + |
| 77 | +### Documentation |
| 78 | + |
| 79 | +The `docs/` directory is the source for the Docusaurus website in `website/`. Docs are published to GitHub Pages. |
0 commit comments