我正在面對一些problems與我的設置,我試圖增加心跳間隔以測試可能的修復程序。 我使用增加春季兔子的心率值
Spring boot 1.3.2.RELEASE
Spring rabbit 1.5.3.RELEASE
和實例連接工廠的代碼是低於
RabbitConnectionFactoryBean connectionFactoryBean = new RabbitConnectionFactoryBean();
connectionFactoryBean.setUseSSL(useSsl);
connectionFactoryBean.setHost(rabbitHostname);
connectionFactoryBean.setVirtualHost(rabbitVhost);
connectionFactoryBean.setUsername(rabbitUsername);
connectionFactoryBean.setPassword(rabbitPassword);
connectionFactoryBean.setConnectionTimeout(900000);
connectionFactoryBean.setRequestedHeartbeat(900);
connectionFactoryBean.afterPropertiesSet();
CachingConnectionFactory cf = new CachingConnectionFactory(connectionFactoryBean.getObject());
cf.setChannelCacheSize(40);
return cf;
的問題是心跳間隔沒有改變。我快速瀏覽一下在AMQConnection揭示了以下
int heartbeat = negotiatedMaxValue(this.requestedHeartbeat,
connTune.getHeartbeat());
private static int negotiatedMaxValue(int clientValue, int serverValue) {
return (clientValue == 0 || serverValue == 0) ?
Math.max(clientValue, serverValue) :
Math.min(clientValue, serverValue);
}
來自服務器的值是60.方法negotiatedMaxValue
不會尊重客戶的偏好(無法禁用心跳,也沒有增加的話)。我錯過了什麼嗎?