【问题标题】:Controlling the rate of messages consumption in HornetQ在 HornetQ 中控制消息消耗率
【发布时间】:2013-04-10 00:20:21
【问题描述】:

我们希望控制消费者在 HornetQ 中消费消息的速率。

问题在于,当我们使用 ServerLocator.setConsumerMaxRate(int) 方法时,无论我们传递的值如何,我们总是每秒收到 1 条消息。

当我们不调用这个方法时,消耗速度很快(每秒超过1个)。

我们的代码:

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

问题是——如何控制消费率?为什么这个设置不影响速率?

【问题讨论】:

    标签: hornetq consumer


    【解决方案1】:

    您是否从 ClientSession 类中尝试过这个方法?:

    ClientConsumer createConsumer(String queueName, String filter, int windowSize, int maxRate, boolean browseOnly) throws HornetQException;
    

    【讨论】:

      猜你喜欢
      • 2016-05-24
      • 2014-11-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-02-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多