Skip to content

Commit b7cdd64

Browse files
feature(#6): this commit includes correlation interceptor as a transient service and adds the handler to all configured HTTP clients, ensuring the propagation of correlation information between services
1 parent c8ba5ac commit b7cdd64

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

  • Boundaries/Comanda.Orchestrator/Source/Comanda.Orchestrator.WebApi/Extensions

Boundaries/Comanda.Orchestrator/Source/Comanda.Orchestrator.WebApi/Extensions/ClientsExtension.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ public static void AddHttpClients(this IServiceCollection services)
99

1010
// registers the header propagation service
1111
// essential for receiving an authenticated request and forwarding it to another service
12+
services.AddTransient<CorrelationInterceptor>();
1213
services.AddHeaderPropagation(options =>
1314
{
1415
options.Headers.Add(Headers.Authorization);
@@ -63,14 +64,27 @@ public static void AddHttpClients(this IServiceCollection services)
6364
});
6465

6566
customersClient.AddHeaderPropagation();
67+
customersClient.AddHttpMessageHandler<CorrelationInterceptor>();
68+
6669
ownersClient.AddHeaderPropagation();
70+
ownersClient.AddHttpMessageHandler<CorrelationInterceptor>();
6771

6872
paymentsClient.AddHeaderPropagation();
73+
paymentsClient.AddHttpMessageHandler<CorrelationInterceptor>();
74+
6975
storesClient.AddHeaderPropagation();
76+
storesClient.AddHttpMessageHandler<CorrelationInterceptor>();
77+
7078
productsClient.AddHeaderPropagation();
79+
productsClient.AddHttpMessageHandler<CorrelationInterceptor>();
7180

7281
subscriptionsClient.AddHeaderPropagation();
82+
subscriptionsClient.AddHttpMessageHandler<CorrelationInterceptor>();
83+
7384
ordersClient.AddHeaderPropagation();
85+
ordersClient.AddHttpMessageHandler<CorrelationInterceptor>();
86+
7487
credentialsClient.AddHeaderPropagation();
88+
credentialsClient.AddHttpMessageHandler<CorrelationInterceptor>();
7589
}
7690
}

0 commit comments

Comments
 (0)