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.
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: