tencent cloud

TDMQ for Apache Pulsar

    ドキュメントTDMQ for Apache Pulsar

    Recommended SDK Configuration Parameters

    フォーカスモード
    フォントサイズ
    最終更新日: 2025-12-24 15:07:56
    This document describes the common parameters for the SDK of TDMQ for Apache Pulsar and provides recommended configurations.

    Producer Configurations

    Parameter
    Description
    Default Value
    Recommended Configuration
    topicName
    Topic name of the message sent.
    None
    Required. You can specify a custom value.
    producerName
    Producer name.
    Cluster name - Random characters
    Keep the default settings. Do not configure.
    sendTimeoutMs
    Sending timeout.
    30s
    It is recommended that you adjust the setting based on the actual situation. To prevent occasional network jitter from affecting the success rate of message sending, it is usually recommended that you set the timeout period to 5s or more (for non-exclusive clusters, it is recommended to set the timeout period to 10s or more).
    maxPendingMessages
    Maximum length of the message sending queue.
    1000
    Keep the default settings.
    maxPendingMessagesAcrossPartitions
    Maximum length of the message sending queue across all partitions.
    50000
    Keep the default settings.
    blockIfQueueFull
    Whether to block when the message sending queue is full.
    false
    Keep the default settings.
    messageRoutingMode
    Message routing mode.
    pulsar.RoundRobinDistribution
    Keep the default settings.
    hashingScheme
    Hashing scheme.
    HashingScheme.JavaStringHash
    Keep the default settings.
    CompressionType
    Compression type. No compression is performed by default.
    No compression
    Keep the default settings.
    batchingEnabled
    Whether to enable batch sending.
    true
    For online scenarios, it is recommended to change the value to false to disable batch sending.
    Batch sending can cause features such as delayed message delivery and message filtering to fail.
    batchingMaxPublishDelayMicros
    Maximum waiting time for batch sending.
    TimeUnit.MILLISECONDS.toMicros(1)
    If batch sending is adopted, it is recommended to change the value to more than 10 ms. A threshold that is too small may result in increased CPU load on the producer.
    batchingMaxMessages
    Maximum number of messages in a single batch.
    1000
    Keep the default settings.
    batchingMaxBytes
    Maximum length of messages in a single batch.
    128k
    Keep the default settings.

    Consumer Configurations

    Parameter
    Description
    Default Value
    Suggestion
    topicNames
    Name list of subscribed topics.
    None
    Required. You can specify a custom value.
    topicsPattern
    Matching pattern for subscribed topics.
    None
    Keep the default settings.
    subscriptionName
    Subscription name.
    None
    Required. You can specify a custom value.
    subscriptionType
    Subscription type.
    SubscriptionType.Exclusive
    Required. For production environments, it is recommended to set the subscription type to Shared.
    receiverQueueSize
    Length of the message receiving queue.
    1000
    Keep the default settings.
    acknowledgementsGroupTimeMicros
    Batch waiting time for acknowledgment requests. A value that is too small may cause a decline in the overall cluster performance.
    100ms
    Keep the default settings.
    negativeAckRedeliveryDelayMicros
    Delay for message redelivery after a negative acknowledgment. If the consumer instance restarts or crashes after being unacknowledged, the message will be immediately redelivered.
    1min
    Keep the default settings.
    maxTotalReceiverQueueSizeAcrossPartitions
    Length of the entire message receiving queue across all partitions.
    50000
    Keep the default settings.
    consumerName
    Consumer name.
    Cluster name - Random characters
    Keep the default settings. Do not configure.
    ackTimeoutMillis
    Acknowledgment timeout period. After the threshold is exceeded, messages will be redelivered for consumption. 0 indicates no timeout period.
    0
    Keep the default settings.
    priorityLevel
    Priority level of the consumer. The server preferentially pushes messages to consumer instances with higher priority. The smaller the number, the higher the priority. 0 represents the highest priority.
    0
    Keep the default settings.
    properties
    The consumer configuration that facilitates server-side query and display. You can use this field to set rules for tags and message filtering.
    None
    Keep the default settings.
    subscriptionInitialPosition
    Initial subscription position. This is the starting point for a consumer's first consumption. By default, consumption begins from the latest position. Messages sent by the topic prior to consumption initiation will not be consumed.
    SubscriptionInitialPosition.Latest
    Keep the default settings.
    patternAutoDiscoveryPeriod
    Interval for automatically detecting changes in the number of partitions. The system periodically obtains the partition metadata of topics to perceive the scale-out of topics in time.
    1min
    Keep the default settings.
    regexSubscriptionMode
    Subscription mode for topics. Three modes are available: subscribing to persistent topics, subscribing to non-persistent topics, and subscribing to all types of topics. By default, persistent topics are subscribed to.
    RegexSubscriptionMode.PersistentOnly
    Keep the default settings.
    retryEnable
    Whether to enable the retry feature.
    false
    Keep the default settings. Configure based on your needs. Refer to the retry and dead letter features.
    deadLetterPolicy
    Retry and dead letter policy.
    None
    Keep the default settings. Configure based on your needs. Refer to the retry and dead letter features.
    autoUpdatePartitions
    Whether to automatically update partitions.
    true
    Keep the default settings.
    replicateSubscriptionState
    Whether to synchronize the consumption progress after cross-cluster synchronization is enabled.
    false
    Keep the default settings.

    ヘルプとサポート

    この記事はお役に立ちましたか?

    フィードバック