Created
November 23, 2020 20:56
-
-
Save ankitvijay/0d77595a367070ff359796e81101f092 to your computer and use it in GitHub Desktop.
Passing Correlation Id to subsequent request
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Startup | |
{ | |
public virtual void ConfigureServices(IServiceCollection services) | |
{ | |
services.AddHttpClient<IMyServiceClient, MyServiceClient>((serviceProvider, client) => | |
{ | |
client.BaseAddress = customerCoreServiceOptions.BaseUri; | |
client.DefaultRequestHeaders.Add("correlation-id", | |
CorrelationIdContext.GetCorrelationId() ?? | |
Guid.NewGuid().ToString()); | |
}); | |
} | |
public void Configure(IApplicationBuilder app) | |
{ | |
// Code removed for brevity | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment