Apache.NMS.ActiveMq ConnectionFactory ignores prefetch set in broker URL

早过忘川 提交于 2019-12-24 13:43:16

问题


This is the URL we're using to create/attach to our queue: tcp://localhost:61616?jms.prefetchPolicy.queuePrefetch=1

This defaults the queuePrefetch to 1000:

IConnectionFactory connectionFactory = new ConnectionFactory(queueServer);
connectionFactory = new SingleConnectionFactory(connectionFactory)
{
    ReconnectOnException = true
};

If we use the following code it sets it appropriatly:

IConnectionFactory connectionFactory = new ConnectionFactory(queueServer)   
{
    PrefetchPolicy = new PrefetchPolicy{QueuePrefetch = 1}
};
connectionFactory = new SingleConnectionFactory(connectionFactory)
{
    ReconnectOnException = true
};

Is there a reason ConnectionFactory is ignoring the prefetch we're setting in the URL? We tried setting the consumer.prefetchSize in the URL as well when connecting consumers and that seemed to do nothing.


回答1:


The NMS library URI options would be prefixed with 'nms.' instead of 'jms.' which is the cause of your issue. So in your case you need to use:

nms.prefetchPolicy.queuePrefetch=1


来源:https://stackoverflow.com/questions/28311148/apache-nms-activemq-connectionfactory-ignores-prefetch-set-in-broker-url

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!