CorrelationId icon indicating copy to clipboard operation
CorrelationId copied to clipboard

Support the IFeaturesCollection

Open stevejgordon opened this issue 5 years ago • 3 comments

There may be value in registering something into the IFeaturesCollection such that downstream middleware can inspect the status of the correlation ID and make decisions based upon it. This feels like a reasonable use of that concept.

Today it's possible to grab the accessor and acting on the value directly but that may be less convenient for downstream middleware.

Useful metadata may include:

  • Was a value provided by the caller?
  • Was the value valid?
  • Was the value generated by the library?

The most useful may be the valid/invalid case.

stevejgordon avatar May 16 '20 06:05 stevejgordon

We use a similar approach: https://github.com/arcus-azure/arcus.webapi/blob/master/src/Arcus.WebApi.Logging/Correlation/CorrelationMiddleware.cs

That way it's super convenient for others, but you're locked in to the HTTP stack which is also a downside.

tomkerkhove avatar May 18 '20 06:05 tomkerkhove

Does correlation ID provide as good alternative to what Rebus correlation ID mechanism provides ? Can I also use this for non HTTP based worker microservices in combination with ASP NET core web api microservices ?

k2ibegin avatar Jun 09 '20 04:06 k2ibegin

@k2ibegin Your question would be best as a new issue since it's not really related to this one. I've not used Rebus to compare what that provides. This library is a simple option for a basic correlation header which can flow to downstream HTTP calls. You can apply this to non HTTP work but you need to link it together. We do this for AWS queues and we often attach the correlation ID as an attribute on the msg which we pull off at the other end. I have considering an integration package for that but it's fairly trivial code.

stevejgordon avatar Jun 22 '20 15:06 stevejgordon