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

集成Spring Reactor #499

Open
Tracked by #432
driventokill opened this issue May 4, 2023 · 1 comment
Open
Tracked by #432

集成Spring Reactor #499

driventokill opened this issue May 4, 2023 · 1 comment

Comments

@driventokill
Copy link
Member

No description provided.

@driventokill
Copy link
Member Author

driventokill commented May 4, 2023

看到 project reactor 已经集成了一个 ThreadLocal 的传递机制 enableAutomaticContextPropagation()

public static void enableAutomaticContextPropagation() {
    if (ContextPropagation.isContextPropagationOnClasspath) {
        Hooks.addQueueWrapper(
                CONTEXT_IN_THREAD_LOCALS_KEY, ContextPropagation.ContextQueue::new
        );
        Schedulers.onScheduleHook(
                CONTEXT_IN_THREAD_LOCALS_KEY,
                ContextPropagation.scopePassingOnScheduleHook()
        );
        ContextPropagation.propagateContextToThreadLocals = true;
    }
}

具体的实现是通过micrometer-metrics/context-propagation

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

No branches or pull requests

1 participant