Skip to content

Commit

Permalink
Use message context as inbound context when available
Browse files Browse the repository at this point in the history
This way middlewares are able to mutate the message context and have
that get threaded through to our invoker
  • Loading branch information
Ben Moss committed Aug 17, 2021
1 parent 236e441 commit e9d58b6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions v2/client/invoker.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ func (r *receiveInvoker) IsResponder() bool {

func computeInboundContext(message binding.Message, fallback context.Context, inboundContextDecorators []func(context.Context, binding.Message) context.Context) context.Context {
result := fallback
if mctx, ok := message.(binding.MessageContext); ok {
result = mctx.Context()
}
for _, f := range inboundContextDecorators {
result = f(result, message)
}
Expand Down

0 comments on commit e9d58b6

Please sign in to comment.