✦ Sample Prompt
Remove leftover RabbitMQ code, config, and packages from every .NET service that
has already migrated to the new broker.
For each repository:
1. Confirm the service is migrated. The default signal: the `*.csproj` already
references `MyOrg.NewBroker.Client` (configurable) and there are no remaining
`IRabbit*` consumers wired in `Program.cs` / `Startup.cs`. If both conditions
are not met, skip the repo and add it to a review list.
2. Remove from `*.csproj`:
- `<PackageReference Include="RabbitMQ.Client" ... />`
- Any internal wrapper packages listed in the prompt (e.g.,
`MyOrg.Messaging.Rabbit`, `MyOrg.RabbitConsumer`)
3. Remove from `appsettings.json` / `appsettings.*.json`:
- The `RabbitMQ` section (`ConnectionString`, `Exchange`, `Queue`, `VHost`, etc.)
- Environment variables: `RABBITMQ_*`
4. Remove from `Startup.cs` / `Program.cs`:
- `services.AddRabbitMq(...)`, `services.AddSingleton<IRabbitConnection>(...)`,
and any `app.UseRabbit*` middleware registrations
5. Delete files under `Messaging/Rabbit/` (or equivalent folders) that are no
longer referenced. If a file is still referenced anywhere in the repo, leave it
and add to the triage list.
6. Do not touch test fixtures unless they only test deleted classes. The Problem
After a messaging migration, the new broker code lands but the old RabbitMQ code rarely gets cleaned up immediately. The `RabbitMQ.Client` NuGet package, connection string config, and helper classes hang around (sometimes for years) confusing on-call engineers when they grep for "broker" and find two implementations.
The cleanup is straightforward (remove the package, delete dead classes, drop the connection string) but spans every migrated service and risks deleting code that’s still half-wired in a few edge cases.
What Tidra Does
- Detects services that already publish to the new broker (configurable signal: presence of the new client package)
- Removes the
RabbitMQ.Clientpackage and any internal wrapper packages from*.csproj - Deletes the RabbitMQ connection string entries from
appsettings*.json - Removes the DI registration for the old client (
services.AddRabbit...) fromStartup.cs/Program.cs - Skips services where RabbitMQ is still referenced in active code paths, with a list for human review
Before & After
diff
src/Service.csproj
<ItemGroup>
<PackageReference Include="MyOrg.NewBroker.Client" Version="2.4.0" />
- <PackageReference Include="RabbitMQ.Client" Version="6.8.1" />
</ItemGroup>
</Project>
Customization Tips
- Detection signal: Provide the canonical "service has migrated" signal, typically the new client package reference or a feature flag.
- Wrapper packages: If you have internal wrappers around
RabbitMQ.Client, list them so Tidra removes them too. - Leftover references: Tidra refuses to delete code that is still referenced. The triage list captures those for owner review.