gpt4 book ai didi

java - 只读 JMS 消息

转载 作者:行者123 更新时间:2023-12-01 14:31:47 25 4
gpt4 key购买 nike

有人可以告诉我为什么 javax.jms.Message 的主体和属性在 JMS 规范中传递后变为只读。这背后有什么正当理由吗?谢谢。

我将通过阅读 Peter Lawrey 稍微改变一下问题评论。当我在读一篇book时如下所述:

> Why are both the body and properties made read-only after delivery? It
> allows the JMS provider more flexibility in implementing the Message
> object. For example, a JMS provider may choose to stream a
> BytesMessage or StreamMessage as it is read, rather than all at once.
> Another vendor may choose to keep properties or body data in an
> internal buffer so that it can be read directly without the need to
> make a copy, which is especially useful with multiple consumers on the
> same client.

这里我无法理解最后一行:

which is especially useful with multiple consumers on the same client

这是什么意思。提前致谢。

最佳答案

无法更改收到的消息,因为这意味着该消息的其他接收者可能会也可能不会看到这些更改。假设更改收到的消息更有可能是一个错误而不是有用的。

关于java - 只读 JMS 消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16820865/

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