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

(RxJava2)Propagators are lazily initialised on first Context Propagation use #10

Open
kabir opened this issue May 12, 2020 · 1 comment

Comments

@kabir
Copy link
Collaborator

kabir commented May 12, 2020

The initialisation of the SmallRyeManager seems to happen on first call of injected ManagedExecutor and ThreadContext instances (and first use of their builders). This in turn adds the ContextManagerExtensions, of which the RxJava2Propagator is one.

So with the following endpoint:

@GET
public Publisher<String> testPublisher() throws SystemException {
       //1
        System.out.println(Flowable.fromArray("X").getClass());
       //2
        ThreadContext.builder().propagated(ThreadContext.ALL_REMAINING).build();
       //3
        System.out.println(Flowable.fromArray("X").getClass());

2 does the initialisation of the SmallRye context manager. The Flowable in 1 is a 'plain' one, and 3 is one which supports context propagation.

This might be an acceptable limitation since the Publisher stuff is a nice to have.

But perhaps the ContextPropagation deployers should do something to eagerly initialise this? Would there be some ramifications of doing this?

@kabir
Copy link
Collaborator Author

kabir commented May 12, 2020

If I comment out all methods in Quarkus's SimpleContextPropagationTest apart from testTransactionContextPropagationPublisher() I end up with something similar to the example (it comes from trying to port that test). In Quarkus it works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant