gpt4 book ai didi

java - 为什么 JMS MessageProducer 方法 setTimeToLive 或 send() 不起作用?

转载 作者:行者123 更新时间:2023-11-30 04:30:10 25 4
gpt4 key购买 nike

我尝试使用这两种方法中的任何一种,以便我通过该生产者发送的消息将过期。例如,我将生存时间设置为 5 秒(5000 毫秒),但即使在 5 秒后,在我订阅后我仍然收到来自消费者的消息。我想知道为什么...

最佳答案

规范说明如下,

When a message's expiration time is reached, a provider should discard it. The JMS API does not define any form of notification of message expiration. Clients should not receive messages that have expired; however, the JMS API does not guarantee that this will not happen.

所以它完全是特定于实现的。您的发布者/订阅者应该按照 JMS 规范以丢弃过期消息的方式实现,否则即使在过期时间之后,您也一定会收到这些消息。

关于java - 为什么 JMS MessageProducer 方法 setTimeToLive 或 send() 不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14825539/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com