gpt4 book ai didi

java - ActiveMQConnectionFactory 发送超时

转载 作者:搜寻专家 更新时间:2023-11-01 03:25:22 28 4
gpt4 key购买 nike

根据 this config page在 ActiveMQ 站点上,connection.sendTimeout 属性是:

Time to wait on Message Sends for a Response, default value of zero indicates to wait forever. Waiting forever allows the broker to have flow control over messages coming from this client if it is a fast producer or there is no consumer such that the broker would run out of memory if it did not slow down the producer. Does not affect Stomp clients as the sends are ack'd by the broker. (Since ActiveMQ-CPP 2.2.1)

我很难理解这意味着什么(以及 sendTimeout 属性的真正含义/它的作用):

  • 什么是“消息发送”对象?
  • 为什么 ActiveMQ 会等待响应?它不是在 JMS 连接的服务器端吗?它不应该等待请求吗?
  • 它实际上超时是什么?什么时候使用?

提前致谢!

最佳答案

超时会影响客户端向 Broker 发送消息。在发送不是异步的情况下,客户端等待 Broker 返回一个响应,指示消息已收到并添加到消息存储中。在某些情况下,如果 Broker 由于达到其预设内存限制之一而启用生产者流量控制,这可能会阻塞很长时间。如果客户端应用程序不能容忍发送时的长时间等待,它可以配置此超时,以便 MessageProducer::send 不会无限期地阻塞。

消息以同步模式发送,因为 Connection 配置为 alwaysSyncSend=true 或因为 MessageProducer 正在发送时将传递模式设置为 Persistent。

一般来说,如果您已使用符合您的用例的限制配置您的 Broker,则不需要使用此设置。

关于java - ActiveMQConnectionFactory 发送超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15315631/

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