Browse Source

Skip to set `CorrelationId ` if current value is `null`.

Resolve #21419
pull/21468/head
maliming 2 years ago
parent
commit
57d4240159
No known key found for this signature in database GPG Key ID: A646B9CB645ECEA4
  1. 5
      framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/DistributedEventBusBase.cs
  2. 6
      framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/ClientProxying/ClientProxyBase.cs
  3. 6
      framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionFinder.cs

5
framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/DistributedEventBusBase.cs

@ -133,7 +133,10 @@ public abstract class DistributedEventBusBase : EventBusBase, IDistributedEventB
Serialize(eventData),
Clock.Now
);
outgoingEventInfo.SetCorrelationId(CorrelationIdProvider.Get()!);
if (CorrelationIdProvider.Get() != null)
{
outgoingEventInfo.SetCorrelationId(CorrelationIdProvider.Get()!);
}
await eventOutbox.EnqueueAsync(outgoingEventInfo);
return true;
}

6
framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/ClientProxying/ClientProxyBase.cs

@ -310,7 +310,11 @@ public class ClientProxyBase<TService> : ITransientDependency
}
//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)

6
framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionFinder.cs

@ -126,7 +126,11 @@ public class ApiDescriptionFinder : IApiDescriptionFinder, ITransientDependency
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)

Loading…
Cancel
Save