consumer

Implements MassTransit consumers and integration events for RabbitMQ messaging in .NET microservices.

1|Updated Apr 27, 2026
One-click install
npx skills add https://github.com/GSU26SE55/backend --skill consumer-gsu26se55
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: consumer
Source: https://github.com/GSU26SE55/backend/tree/main/.codex/skills/be/consumer
Command: npx skills add https://github.com/GSU26SE55/backend --skill consumer-gsu26se55

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Backend developers working on this .NET 9 microservices platform need a consistent, convention-driven way to create RabbitMQ consumers and integration events without guessing folder structure, naming patterns, or publish/commit ordering. ## Core Features & Use Cases - Integration Event Scaffolding: Defines events as C# records in SharedContracts/Events following the {Action}Event naming convention. - Consumer Implementation: Generates IConsumer<T> classes in Infrastructure/Consumers with UnitOfWork transaction handling and MassTransit auto-retry on throw. - Publish Ordering Rules: Enforces correct publish timing — after CommitTransactionAsync for services without Outbox, before SaveChangesAsync for services with Outbox. - Use Case: When adding a BatteryAnomalyDetectedEvent flow, the Skill produces the event record, the consumer with transactional business logic, and the AddMessageBus DI registration in one pass. ## Quick Start Ask the AI to create a MassTransit consumer and integration event for a new domain event, specifying which service publishes and which consumes.

Frequently Asked Questions about consumer

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a MassTransit consumer in a .NET microservice?▼

Create a class implementing IConsumer<TEvent> in Infrastructure/Consumers, inject the service UnitOfWork, and implement Consume with your business logic. Wrap mutations in BeginTransactionAsync/CommitTransactionAsync and rethrow on failure so MassTransit auto-retries.

How to define an integration event for RabbitMQ with MassTransit?▼

Define the event as a C# record (not a class) implementing IntegrationEvent, placed in SharedContracts/Events/{EventName}.cs. Use the {Action}Event naming pattern, for example BatteryAnomalyDetectedEvent, with init-style properties.

When should I publish an event before or after committing the transaction?▼

Services without an Outbox publish after CommitTransactionAsync to avoid emitting events for rolled-back work. Services with an Outbox publish before SaveChangesAsync so the event and state change persist atomically.

How does MassTransit retry failed consumers?▼

MassTransit automatically retries when the Consume method throws. The pattern is to catch exceptions, call RollbackTransactionAsync on the UnitOfWork, then rethrow so the bus handles retry and eventual error queues.

How do I register MassTransit consumers in dependency injection?▼

Call services.AddMessageBus(configuration, typeof(YourConsumer).Assembly) during startup. Passing the consumer's assembly lets the registration scan and wire up all consumers in that service automatically.