Apache.NMS.ActiveMq ConnectionFactory ignores pref

2019-08-08 08:11发布

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.

标签: activemq
1条回答
狗以群分
2楼-- · 2019-08-08 08:28

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
查看更多
登录 后发表回答