Abp microservices

From burakdmir/abp-skills · View interactive version

Abp microservices is an AI agent skill from the GitHub repository burakdmir/abp-skills. ABP Framework v10.x (10.4–10.6) microservice quick reference: Integration Services [IntegrationService], distributed events (RabbitMQ Outbox/Inbox), YARP gateway, OpenIddict, Entity Cache, database-per-service. Use when you need microservices or inter-service communication in ABP.

How to use this skill

Skill file

ABP Framework — Microservices

ABP v10.x microservice template (Business+). Synchronous = Integration Services, asynchronous = distributed events. YARP gateway + OpenIddict auth server.

Trigger

"ABP microservices", "integration service", "inter-service communication", "distributed event", "YARP gateway", "auth server".

Structure

apps/{web,public-web,auth-server}  gateways/web-gateway(YARP)
services/{administration,identity,...}  etc/{docker,helm}

Services are NOT layered: a single project + *.Contracts (interface/DTO/ETO) + *.Tests. DbContext: IHasEventInbox, IHasEventOutbox.

Synchronous — Integration Service

// Contracts
[IntegrationService]
public interface IProductIntegrationService : IApplicationService
{ Task<List<ProductDto>> GetProductsByIdsAsync(List<Guid> ids); }

// Service
[IntegrationService]
public class ProductIntegrationService : ApplicationService, IProductIntegrationService { /* ... */ }

// Provider module: options.ExposeIntegrationServices = true;
// Consumer module: context.Services.AddStaticHttpClientProxies(typeof(CatalogServiceContractsModule).Assembly, "CatalogService");
abp generate-proxy -t csharp -u http://localhost:44361 -m catalog --without-contracts
"RemoteServices": { "CatalogService": { "BaseUrl": "http://localhost:44361" } }

Use an Integration Service, not an application service. When: immediate response + data needed for the operation.

Asynchronous — Distributed Event (RabbitMQ)

[EventName("Product.StockChanged")]
public class StockCountChangedEto { public Guid ProductId { get; set; } public int NewCount { get; set; } }

await _distributedEventBus.PublishAsync(new StockCountChangedEto { ... });

public class Handler : IDistributedEventHandler<StockCountChangedEto>, ITransientDependency
{ public async Task HandleEventAsync(StockCountChangedEto e) { } }

When: state change notifications, loose coupling. Handlers must be idempotent.

Entity Cache

context.Services.AddEntityCache<Product, ProductDto, Guid>();
private readonly IEntityCache<ProductDto, Guid> _cache; // _cache.GetAsync(id)

Built-in infrastructure: RabbitMQ, Redis, YARP, OpenIddict.

Best Practices

  1. Choose the right communication (synchronous query / asynchronous notification)
  2. Inter-service → Integration Service
  3. Share only Contracts, idempotent handlers
  4. Database-per-service, cache remote data

Related

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.