wolverine
wolverine copied to clipboard
Ability to pass options/headers when using InvokeAsync
Is your feature request related to a problem? Please describe.
I am trying to pass metadata (e.g., userId, etc.) alongside messages in message headers. When using SendAsync or PublishAsync, I can easily pass options as method param. However, InvokeAsync does not allow this.
I've tried passing options using the WithDeliveryOptions method. The problem is that routing then does not find handlers that do not request a wrapped message (DeliveryMessage<T>).
Describe the solution you'd like
It would be helpful if InvokeAsync could accept options in the same way that SendAsync does.
Or is there any other approach that would solve my problem?
Describe alternatives you've considered
Currently, I pass the user ID using a field intended for tenancy.
Additional context
The metadata I need is processed by middleware and is not required in the handlers.
@MichalTichy This is going to be tedious. I think I'd like to push this off until Wolverine 4 so we can make a breaking API change to add DeliveryOptions as an optional parameter to InvokeAsync() instead of having to create umpteen overloads
Ironically, I found a potential solution to my problem (no delivery options on SendAsync) and it has just been removed from the 4.0 milestone! Any idea when this might be addressed, please?
I'd argue this should be a (bit of a) priority, given the way Wolverine plays with IoC (not judging, just saying), being able to pass metadata on InvokeAsync is a must, often we need more than the support for "tenant-id".
Even if runtime IoC is considered non-idiomatic Wovlerine usage (references: #501, 533, Dicord among others) (and again, not saying it should change, it is a trade-off and everyone must decide by themselves if Wolverine is for them or not), I think this will help A LOT to reduce those scenarios.