簡體   English   中英

使用 spring 雲 stream 兔子 mq binder 在 header 中發送消息 TTL

[英]Send message TTL in header using spring cloud stream rabbit mq binder

我想將 spring 雲 stream rabbitMQ 活頁夾用於消息驅動的架構。 但是每條消息都應該有自己的生存時間設置。 所以我需要在消息 header 中給出這個設置。 您認為使用 Spring Cloud Stream RabbitMQ Binder 是否可行?

   Message message1 = MessageBuilder.withPayload(new PFSimulationEvent(1, "sd"))
            .setHeader("to_process", true).setHeader("expiration", 10000)
            .build();
        output.send("simulatePf-out-0", message1);

是的,您可以通過多種方式做到這一點 - https://docs.spring.io/spring-cloud-function/docs/current/reference/html/spring-cloud-function.html#_inputoutput_enrichment最新添加是通過input/output-header-mapping-expression

此功能與 binder 無關,因為它位於 spring-cloud-function 級別,並且可以與任何 binder 一起使用。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM