0

We want to control the rate at which a consumer can consume messages in HornetQ.

The problem is that when we use the ServerLocator.setConsumerMaxRate(int) method, we get always 1 message per second, regardless of the value we pass.

When we don’t call this method, the consuming rate is fast (much more than 1 per second).

Our code:

        TransportConfiguration connectorConfig = new TransportConfiguration(InVMConnectorFactory.class.getName());

        ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(connectorConfig);

        locator.setAckBatchSize(ackBatchSize);
        locator.setConsumerWindowSize(CONSUMER_WINDOW_SIZE);
        locator.setClientFailureCheckPeriod(Long.MAX_VALUE);
        locator.setConnectionTTL(-1);
        locator.setConsumerMaxRate(10);

The question is - how to control the consumption rate ? and why this setting does not affect the rate ?

Elad Eldor
  • 803
  • 1
  • 12
  • 22

1 Answers1

0

Did you try this method from ClientSession class?:

ClientConsumer createConsumer(String queueName, String filter, int windowSize, int maxRate, boolean browseOnly) throws HornetQException;
Arya
  • 2,809
  • 5
  • 34
  • 56