gpt4 book ai didi

java - 关于 JMS receive()/MessageListener 优先级的问题

转载 作者:行者123 更新时间:2023-11-29 06:10:47 26 4
gpt4 key购买 nike

如果我为 MessageConsumer 设置一个 MessageListener 对象,然后对该消费者调用 receive(),会发生什么?提供者会将消息交给 receive(),还是在消息被 MessageListener 对象处理时继续阻塞?

最佳答案

您将得到一个异常,因为 Session 必须处于异步或同步模式。来自JMS规范的4.4.6

One consequence of the session’s single-thread-of-control restriction is that a session with message listeners cannot also be used to synchronously receive messages. Either the session is dedicated to the thread of control used for delivery to message listeners or it is dedicated to a thread of control initiated by client code. It is erroneous to attempt to combine both in the same session.

关于java - 关于 JMS receive()/MessageListener 优先级的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6938852/

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