tencent cloud

Feedback

Message Pulling Frequency

Last updated: 2023-10-19 11:08:40
    TDMQ for RocketMQ provides two consumption modes: Push and Pull. The Push mode is implemented based on the Pull mode, wrapping a layer on the Pull mode. It is a variant of the Pull mode rather than a true Push mode.
    Therefore, it can be considered that the TDMQ for RocketMQ SDK continuously performs message pulling tasks. Below are the possible results of each pull:
    After the SDK successfully pulls messages, if some messages are filtered out (such as by tag), it will put the message pulling request to the blocking queue to pull messages in a loop; otherwise, the messages will be put to the consumer for consumption while the message pulling request will be put to the blocking queue.
    If no new messages are available in the broker or no messages are matched, pullRequest will be put to the blocking queue to continue to pull messages in a loop.
    That is to say, as long as the consumer is online, it will initiate requests to the server periodically even if no messages are produced. This can ensure the timeliness of message consumption. If you want to reduce the number of pulls, refer to the following section.

    How to Control Pulling Frequency

    In the Pull mode, you can actively control the message pulling frequency of consumers by using throttling components or waiting for a desired period of time before the next pull.
    In the Push mode, you can use PullInterval to set the message pulling interval for consumers.
     // Set the interval to 60s
    pushConsumer.setPullInterval(60 * 1000);
    Note
    Modifying the message pulling interval may cause a higher consumption delay. Therefore, proceed with caution.
    If a small number of messages are produced, the long polling time of fixed 15s will be readily reached; that is, a broker will initiate at least four pulls for a queue per minute. If there are 10 topics with 3 queues each, and there are 2 brokers on the server, the number of pulls will be 240 (1032*4). In this case, four pulls are initiated per second.
    In actual scenarios, retry topics may be generated during the production and consumption processes. As the retry queue also needs to be pulled, the message pulling frequency will increase.
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support