Skip to content

Propagate informations from inbound messages up to Client#659

Merged
n3wscott merged 3 commits intocloudevents:masterfrom
slinkydeveloper:message_context
Jan 27, 2021
Merged

Propagate informations from inbound messages up to Client#659
n3wscott merged 3 commits intocloudevents:masterfrom
slinkydeveloper:message_context

Conversation

@slinkydeveloper
Copy link
Copy Markdown
Member

@slinkydeveloper slinkydeveloper commented Jan 27, 2021

Now MessageContext is not replaced anymore (like done in #634) but it can be used together with a context decorator function.

Signed-off-by: Francesco Guardiani francescoguard@gmail.com

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
…om the ObservabilityService

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
@slinkydeveloper
Copy link
Copy Markdown
Member Author

slinkydeveloper commented Jan 27, 2021

cc @n3wscott, look the #658 for more details on why this change

@dan-j
Copy link
Copy Markdown
Contributor

dan-j commented Jan 27, 2021

For this to be useful towards #658, we'd also need a way to add custom decorators to ceClient.inboundContextDecorators.

Perhaps a new option?

// it may also be useful to type the decorator signature to make it easier to read
type ContextDecorator func(context.Context) context.Context

func WithInboundContextDecorators(decorators ...ContextDecorator) Option {
  return func(i interface{}) error {
    if c, ok := i.(*ceClient); ok {
      c.inboundContextDecorators = append(c.inboundContextDecorators, decorators...)
    }
    return nil
  }
}

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
@slinkydeveloper
Copy link
Copy Markdown
Member Author

@dan-j Added a new option

@dan-j
Copy link
Copy Markdown
Contributor

dan-j commented Jan 27, 2021

LGTM

@slinkydeveloper slinkydeveloper added this to the SDK 2.4 milestone Jan 27, 2021
@n3wscott
Copy link
Copy Markdown
Member

LGTM

@n3wscott n3wscott merged commit 4bb7a51 into cloudevents:master Jan 27, 2021
@slinkydeveloper slinkydeveloper deleted the message_context branch January 27, 2021 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants