diff --git a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/DistributedEventBusBase.cs b/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/DistributedEventBusBase.cs index 72a20748c68..96a11f928ec 100644 --- a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/DistributedEventBusBase.cs +++ b/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/DistributedEventBusBase.cs @@ -132,7 +132,13 @@ protected virtual async Task AddToOutboxAsync(Type eventType, object event Serialize(eventData), Clock.Now ); - outgoingEventInfo.SetCorrelationId(CorrelationIdProvider.Get()!); + + var correlationId = CorrelationIdProvider.Get(); + if (correlationId != null) + { + outgoingEventInfo.SetCorrelationId(correlationId); + } + await eventOutbox.EnqueueAsync(outgoingEventInfo); return true; } diff --git a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/ClientProxying/ClientProxyBase.cs b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/ClientProxying/ClientProxyBase.cs index a4306050a4d..e2562d28cd1 100644 --- a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/ClientProxying/ClientProxyBase.cs +++ b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/ClientProxying/ClientProxyBase.cs @@ -309,7 +309,11 @@ protected virtual void AddHeaders( } //CorrelationId - requestMessage.Headers.Add(AbpCorrelationIdOptions.Value.HttpHeaderName, CorrelationIdProvider.Get()); + var correlationId = CorrelationIdProvider.Get(); + if (correlationId != null) + { + requestMessage.Headers.Add(AbpCorrelationIdOptions.Value.HttpHeaderName, correlationId); + } //TenantId if (CurrentTenant.Id.HasValue) diff --git a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionFinder.cs b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionFinder.cs index 10089c52cd0..e54e24ced0e 100644 --- a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionFinder.cs +++ b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionFinder.cs @@ -126,7 +126,11 @@ protected virtual async Task GetApiDescriptionFr protected virtual void AddHeaders(HttpRequestMessage requestMessage) { //CorrelationId - requestMessage.Headers.Add(AbpCorrelationIdOptions.HttpHeaderName, CorrelationIdProvider.Get()); + var correlationId = CorrelationIdProvider.Get(); + if (correlationId != null) + { + requestMessage.Headers.Add(AbpCorrelationIdOptions.HttpHeaderName, correlationId); + } //TenantId if (CurrentTenant.Id.HasValue)