惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

大猫的无限游戏
大猫的无限游戏
阮一峰的网络日志
阮一峰的网络日志
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
WordPress大学
WordPress大学
博客园 - 叶小钗
Hugging Face - Blog
Hugging Face - Blog
博客园 - 司徒正美
Last Week in AI
Last Week in AI
罗磊的独立博客
量子位
Jina AI
Jina AI
T
Tailwind CSS Blog
Apple Machine Learning Research
Apple Machine Learning Research
IT之家
IT之家
美团技术团队
雷峰网
雷峰网
爱范儿
爱范儿
S
SegmentFault 最新的问题
小众软件
小众软件
月光博客
月光博客
酷 壳 – CoolShell
酷 壳 – CoolShell
人人都是产品经理
人人都是产品经理
The Cloudflare Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报

博客园 - 荣锋亮

just-git 纯js 的git 实现 阿里开源的UnifiedModel agno agentos interfaces 简单说明 agno agentos ag-ui 协议 agno agentos 暴露a2a 协议 agno gateway模式 agno 多agent 框架集成能力 agno agentos 简单说明 agno workflow 模式简单说明 agno team agent 简单说明 agno remote agent 简单说明 agno agent 使用 agno agent 平台 sshpiper 简单试用 sshpiper ssh 的反向代理服务 nginx 发布1.31.2 了 reductstore 的一些部署模式 reductstore 数据写入模式 reductstore bridge 方便reductstore数据bridge 扩展 reductstore zenoh 集成 zenoh 1.9.x 一些新特性 ladybugdb嵌入式图数据库 BlockHound 检测 reactor阻塞调用的agent reductstore 高性能面向机器人以及IOT场景的存储以及流数据基石 zerofs 一些新功能 java nats request-many 支持的一些模式 java nats RequestMany context7 面向llm 以及ai代码编辑器的依赖包更新平台 NATS Agents Protocol nats 团队提出的agent 通信协议 metamcp mcp聚合&调度工具
context-propagation spring reactor 的上下文传递包
荣锋亮 · 2026-06-21 · via 博客园 - 荣锋亮

context-propagation 是一个比较强大的上下文传递包,对于上下文处理进行了一些抽象,可以兼容传统ThreadLocal的一些处理

参考玩法

包含了自动模式`Hooks.enableAutomaticContextPropagation();`

static final ThreadLocal<String> TL = new ThreadLocal<>();
    static final String TLKEY = "demo";

    public static void main(String[] args) throws InterruptedException {
        BlockHound.install();
        ReactorDebugAgent.init();
        Hooks.enableAutomaticContextPropagation();
        ContextRegistry.getInstance()
                .registerThreadLocalAccessor(
                        TLKEY,
                        TL::get,
                        TL::set,
                        TL::remove
                );
        TL.set("HELLO");
        var info = Mono.deferContextual(ctx ->
                        Mono.delay(Duration.ofSeconds(1))
                                // we're now in another thread, TL is not explicitly set
                                .map(v -> "delayed ctx[" + TLKEY + "]=" + ctx.getOrDefault(TLKEY, "not found") + ", TL=" + TL.get()))
                .block(); // returns "delayed ctx[TLKEY]=HELLO, TL=null" in default mode
        // returns "delayed ctx[TLKEY]=HELLO, TL=HELLO" in automatic mode
        System.out.println(info);
    }

说明

context-propagation 包是一个比较有用的,尤其在链路追踪场景中

参考资料

https://aabir-hassan.medium.com/demystifying-spring-webflux-the-reactor-context-part-4-3169d02ae2f4

https://docs.micrometer.io/context-propagation/reference/usage.html

https://github.com/micrometer-metrics/context-propagation

https://projectreactor.io/docs/core/3.8.6-SNAPSHOT/reference/advanced-contextPropagation.html