From 145293fc57f2f9fac37324ce5606aa3f673bb2fd Mon Sep 17 00:00:00 2001 From: maliming Date: Sat, 14 Feb 2026 15:31:10 +0800 Subject: [PATCH] Fix code examples and links in correlation-id document --- .../en/framework/infrastructure/correlation-id.md | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/docs/en/framework/infrastructure/correlation-id.md b/docs/en/framework/infrastructure/correlation-id.md index 04fe32108f..15ce5b9677 100644 --- a/docs/en/framework/infrastructure/correlation-id.md +++ b/docs/en/framework/infrastructure/correlation-id.md @@ -57,20 +57,25 @@ You can inject `ICorrelationIdProvider` into any service to access the current c ```csharp public class MyService : ITransientDependency { + public ILogger Logger { get; set; } + private readonly ICorrelationIdProvider _correlationIdProvider; public MyService(ICorrelationIdProvider correlationIdProvider) { + Logger = NullLogger.Instance; _correlationIdProvider = correlationIdProvider; } - public void DoSomething() + public async Task DoSomethingAsync() { // Get the current correlation ID var correlationId = _correlationIdProvider.Get(); - + // Use it for logging, tracing, etc. Logger.LogInformation("Processing with Correlation ID: {CorrelationId}", correlationId); + + await SomeOperationAsync(); } } ``` @@ -136,9 +141,9 @@ No manual configuration is required. ABP's `ClientProxyBase` automatically reads ### Distributed Event Bus -When you publish a [distributed event](../infrastructure/event-bus/distributed/index.md), ABP automatically attaches the current correlation ID to the outgoing event message. When the event is consumed (potentially by a different service), the correlation ID is extracted from the message and set in the consumer's context. +When you publish a [distributed event](./event-bus/distributed/index.md), ABP automatically attaches the current correlation ID to the outgoing event message. When the event is consumed (potentially by a different service), the correlation ID is extracted from the message and set in the consumer's context. -> This works with all supported event bus providers. Including, [RabbitMQ](../infrastructure/event-bus/distributed/rabbitmq.md), [Kafka](../infrastructure/event-bus/distributed/kafka.md), [Azure Service Bus](../infrastructure/event-bus/distributed/azure.md) and [Rebus](../infrastructure/event-bus/distributed/rebus.md). +> This works with all supported event bus providers, including [RabbitMQ](./event-bus/distributed/rabbitmq.md), [Kafka](./event-bus/distributed/kafka.md), [Azure Service Bus](./event-bus/distributed/azure.md) and [Rebus](./event-bus/distributed/rebus.md). ``` Service A publishes event (CorrelationId: abc123) @@ -170,4 +175,4 @@ The correlation ID is enriched as a log property named `CorrelationId` by defaul - [Audit Logging](./audit-logging.md) - [Distributed Event Bus](./event-bus/distributed/index.md) -- [Dynamic Client Proxies](../api-development/dynamic-csharp-clients.md) \ No newline at end of file +- [Dynamic Client Proxies](../api-development/dynamic-csharp-clients.md)