I have a bunch of micro services in .NET Core and I plan to host message handlers there. The internal service layers of these services will be called by both web api controllers and the message handler.
Some of the data are set in current httpContext in web api level (through filters etc) and service layer gets data through httpContext.Current. For example, my AuthenticationFilter sets UserIdentity to the current httpContext so that server layers get current user info there. We also use Items collection. This works fine since each web api request is distinct and separated from each other.
But now we have message handlers that are invoked by NServiceBus. Since they are not through the normal MVC pipeline, I wonder what’s the implication on their HttpContext. Does each invocation have brand new and district HttpContext? Can I still pass message-specific data in httpContext.Current?
This is .net core 2.0. Thanks!