Apache.NMS.ActiveMq ConnectionFactory忽略代理URL中设置的预取 [英] Apache.NMS.ActiveMq ConnectionFactory ignores prefetch set in broker URL

查看:523
本文介绍了Apache.NMS.ActiveMq ConnectionFactory忽略代理URL中设置的预取的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我们用于创建/附加到队列的URL:tcp:// localhost:61616?jms.prefetchPolicy.queuePrefetch = 1

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

这默认将queuePrefetch设置为1000:

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
};

ConnectionFactory是否有理由忽略我们在URL中设置的预取?在连接消费者时,我们也尝试在URL中设置consumer.prefetchSize,但这似乎无济于事。

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.

推荐答案

NMS库URI选项的前缀为 nms。而不是 jms。,这是导致您出现问题的原因。因此,在您的情况下,您需要使用:

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

这篇关于Apache.NMS.ActiveMq ConnectionFactory忽略代理URL中设置的预取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆