Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure that the context is set throughout the request lifecycle #2898

Merged

Conversation

romain-grecourt
Copy link
Contributor

@romain-grecourt romain-grecourt commented Mar 31, 2021

  • Added Context to RequestContext:
    • added a method "runInScope" to invoke Contexts.runInContext + logging
    • added "in-scope" short-hand methods for publisher.fail, publisher.emit, publisher.complete
    • removed "publisher()" to force the use of the in-scope short-hand methods
  • Request only creates a new context if Contexts.context() is empty
    • NOT throwing an exception as that would impact Routing.route which is a public API
  • Added a unit test

Fixes #2838

Added Context to RequestContext:
 - added a method "runInScope" to invoke Contexts.runInContext + logging
 - added "in-scope" short-hand methods for publisher.fail, publisher.emit, publisher.complete
 - removed "publisher()" to force the use of the in-scope short-hand methods
Request only creates a new context if Contexts.context() is empty
 - NOT throwing an exception as that would impact Routing.route which is a public API
Added a unit test
Copy link
Member

@tomas-langer tomas-langer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@romain-grecourt romain-grecourt merged commit 9b67ec7 into helidon-io:master Apr 1, 2021
@romain-grecourt romain-grecourt deleted the context-request-lifecycle branch April 15, 2021 20:43
aseovic pushed a commit to aseovic/helidon that referenced this pull request Apr 26, 2021
…don-io#2898)

* Ensure that the context is set throughout the request lifecycle.
Added Context to RequestContext:
 - added a method "runInScope" to invoke Contexts.runInContext + logging
 - added "in-scope" short-hand methods for publisher.fail, publisher.emit, publisher.complete
 - removed "publisher()" to force the use of the in-scope short-hand methods
Request only creates a new context if Contexts.context() is empty
 - NOT throwing an exception as that would impact Routing.route which is a public API
Added a unit test

* Update TestClient to setup the context
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.

Context is not available throughout request lifecycle
3 participants