Class PulsarConfiguration

    • Constructor Detail

      • PulsarConfiguration

        public PulsarConfiguration()
    • Method Detail

      • isTopicsPattern

        public boolean isTopicsPattern()
      • setTopicsPattern

        public void setTopicsPattern​(boolean topicsPattern)
        Whether the topic is a pattern (regular expression) that allows the consumer to subscribe to all matching topics in the namespace
      • getSubscriptionTopicsMode

        public org.apache.pulsar.client.api.RegexSubscriptionMode getSubscriptionTopicsMode()
      • setSubscriptionTopicsMode

        public void setSubscriptionTopicsMode​(org.apache.pulsar.client.api.RegexSubscriptionMode subscriptionTopicsMode)
        Determines to which topics this consumer should be subscribed to - Persistent, Non-Persistent, or both. Only used with pattern subscriptions.
      • getSubscriptionName

        public String getSubscriptionName()
      • setSubscriptionName

        public void setSubscriptionName​(String subscriptionName)
        Name of the subscription to use
      • setSubscriptionType

        public void setSubscriptionType​(SubscriptionType subscriptionType)
        Type of the subscription [EXCLUSIVE|SHARED|FAILOVER|KEY_SHARED], defaults to EXCLUSIVE
      • getNumberOfConsumers

        public int getNumberOfConsumers()
      • setNumberOfConsumers

        public void setNumberOfConsumers​(int numberOfConsumers)
        Number of consumers - defaults to 1
      • getConsumerQueueSize

        public int getConsumerQueueSize()
      • setConsumerQueueSize

        public void setConsumerQueueSize​(int consumerQueueSize)
        Size of the consumer queue - defaults to 10
      • getConsumerName

        public String getConsumerName()
      • setConsumerName

        public void setConsumerName​(String consumerName)
        Name of the consumer when subscription is EXCLUSIVE
      • getProducerName

        public String getProducerName()
      • setProducerName

        public void setProducerName​(String producerName)
        Name of the producer. If unset, lets Pulsar select a unique identifier.
      • getConsumerNamePrefix

        public String getConsumerNamePrefix()
      • setConsumerNamePrefix

        public void setConsumerNamePrefix​(String consumerNamePrefix)
        Prefix to add to consumer names when a SHARED or FAILOVER subscription is used
      • isAllowManualAcknowledgement

        public boolean isAllowManualAcknowledgement()
      • setAllowManualAcknowledgement

        public void setAllowManualAcknowledgement​(boolean allowManualAcknowledgement)
        Whether to allow manual message acknowledgements.

        If this option is enabled, then messages are not acknowledged automatically after successful route completion. Instead, an instance of PulsarMessageReceipt is stored as a header on the Exchange. Messages can then be acknowledged using PulsarMessageReceipt at any time before the ackTimeout occurs.

      • getAckTimeoutMillis

        public long getAckTimeoutMillis()
      • setAckTimeoutMillis

        public void setAckTimeoutMillis​(long ackTimeoutMillis)
        Timeout for unacknowledged messages in milliseconds - defaults to 10000
      • getAckGroupTimeMillis

        public long getAckGroupTimeMillis()
      • setAckGroupTimeMillis

        public void setAckGroupTimeMillis​(long ackGroupTimeMillis)
        Group the consumer acknowledgments for the specified time in milliseconds - defaults to 100
      • setSendTimeoutMs

        public void setSendTimeoutMs​(int sendTimeoutMs)
        Send timeout in milliseconds. Defaults to 30,000ms (30 seconds)
      • getSendTimeoutMs

        public int getSendTimeoutMs()
      • setBlockIfQueueFull

        public void setBlockIfQueueFull​(boolean blockIfQueueFull)
        Set whether the send and asyncSend operations should block when the outgoing message queue is full. If set to false, send operations will immediately fail with ProducerQueueIsFullError when there is no space left in the pending queue. Default is false.
      • isBlockIfQueueFull

        public boolean isBlockIfQueueFull()
      • setMaxPendingMessages

        public void setMaxPendingMessages​(int maxPendingMessages)
        Set the max size of the queue holding the messages pending to receive an acknowledgment from the broker. Default is 1000.
      • getMaxPendingMessages

        public int getMaxPendingMessages()
      • setMaxPendingMessagesAcrossPartitions

        @Deprecated
        public void setMaxPendingMessagesAcrossPartitions​(int maxPendingMessagesAcrossPartitions)
        Deprecated.
        Set the number of max pending messages across all the partitions. Default is 50000. This option is deprecated and will be removed in a future version.
      • getMaxPendingMessagesAcrossPartitions

        @Deprecated
        public int getMaxPendingMessagesAcrossPartitions()
        Deprecated.
      • setBatchingMaxPublishDelayMicros

        public void setBatchingMaxPublishDelayMicros​(long batchingMaxPublishDelayMicros)
        Set the time period within which the messages sent will be batched if batch messages are enabled. If set to a non zero value, messages will be queued until either:
        • this time interval expires
        • the max number of messages in a batch is reached
        Default is 1ms.
      • getBatchingMaxPublishDelayMicros

        public long getBatchingMaxPublishDelayMicros()
      • setBatchingMaxMessages

        public void setBatchingMaxMessages​(int batchingMaxMessages)
        Set the maximum number of messages permitted in a batch. Default 1,000.
      • getBatchingMaxMessages

        public int getBatchingMaxMessages()
      • setBatchingEnabled

        public void setBatchingEnabled​(boolean batchingEnabled)
        Control whether automatic batching of messages is enabled for the producer. Default is true.
      • isBatchingEnabled

        public boolean isBatchingEnabled()
      • setBatcherBuilder

        public void setBatcherBuilder​(org.apache.pulsar.client.api.BatcherBuilder batcherBuilder)
        Control batching method of the Pulsar producer. KEY_BASED batches based on the Pulsar message key. DEFAULT batches all messages together regardless of key; this may cause only a single consumer to work when consuming using a KEY_SHARED subscription. Default is DEFAULT.
      • getBatcherBuilder

        public org.apache.pulsar.client.api.BatcherBuilder getBatcherBuilder()
      • setSubscriptionInitialPosition

        public void setSubscriptionInitialPosition​(SubscriptionInitialPosition subscriptionInitialPosition)
        Control the initial position in the topic of a newly created subscription. Default is latest message.
      • isReadCompacted

        public boolean isReadCompacted()
        Enable compacted topic reading.
      • setReadCompacted

        public void setReadCompacted​(boolean readCompacted)
      • setInitialSequenceId

        public void setInitialSequenceId​(long initialSequenceId)
        Set the baseline for the sequence ids for messages published by the producer. First message will be using (initialSequenceId 1) as its sequence id and subsequent messages will be assigned incremental sequence ids, if not otherwise specified.
      • getInitialSequenceId

        public long getInitialSequenceId()
      • setCompressionType

        public void setCompressionType​(String compressionType)
        Set the compression type for the producer.
      • setCompressionType

        public void setCompressionType​(org.apache.pulsar.client.api.CompressionType compressionType)
        Set the compression type for the producer.
      • getCompressionType

        public org.apache.pulsar.client.api.CompressionType getCompressionType()
      • getMessageRoutingMode

        public org.apache.pulsar.client.api.MessageRoutingMode getMessageRoutingMode()
        Set the message routing mode for the producer.
      • setMessageRoutingMode

        public void setMessageRoutingMode​(org.apache.pulsar.client.api.MessageRoutingMode messageRoutingMode)
      • getMessageRouter

        public org.apache.pulsar.client.api.MessageRouter getMessageRouter()
        Set a custom Message Router.
      • setMessageRouter

        public void setMessageRouter​(org.apache.pulsar.client.api.MessageRouter messageRouter)
      • getNegativeAckRedeliveryDelayMicros

        public long getNegativeAckRedeliveryDelayMicros()
      • setNegativeAckRedeliveryDelayMicros

        public void setNegativeAckRedeliveryDelayMicros​(long negativeAckRedeliveryDelayMicros)
        Set the negative acknowledgement delay
      • getAckTimeoutRedeliveryBackoff

        public org.apache.pulsar.client.api.RedeliveryBackoff getAckTimeoutRedeliveryBackoff()
      • setAckTimeoutRedeliveryBackoff

        public void setAckTimeoutRedeliveryBackoff​(org.apache.pulsar.client.api.RedeliveryBackoff redeliveryBackoff)
        Set a RedeliveryBackoff to use for ack timeout redelivery backoff.
      • getNegativeAckRedeliveryBackoff

        public org.apache.pulsar.client.api.RedeliveryBackoff getNegativeAckRedeliveryBackoff()
      • setNegativeAckRedeliveryBackoff

        public void setNegativeAckRedeliveryBackoff​(org.apache.pulsar.client.api.RedeliveryBackoff redeliveryBackoff)
        Set a RedeliveryBackoff to use for negative ack redelivery backoff.
      • getMaxRedeliverCount

        public Integer getMaxRedeliverCount()
      • setMaxRedeliverCount

        public void setMaxRedeliverCount​(Integer maxRedeliverCount)
      • getDeadLetterTopic

        public String getDeadLetterTopic()
      • setDeadLetterTopic

        public void setDeadLetterTopic​(String deadLetterTopic)
      • isMessageListener

        public boolean isMessageListener()
      • setMessageListener

        public void setMessageListener​(boolean messageListener)
      • getNumberOfConsumerThreads

        public int getNumberOfConsumerThreads()
      • setNumberOfConsumerThreads

        public void setNumberOfConsumerThreads​(int numberOfConsumerThreads)
        Number of consumers threads - defaults to 1
      • getServiceUrl

        public String getServiceUrl()
      • setServiceUrl

        public void setServiceUrl​(String serviceUrl)
        The Pulsar Service URL to point while creating the client from URI
      • getAuthenticationClass

        public String getAuthenticationClass()
      • setAuthenticationClass

        public void setAuthenticationClass​(String authenticationClass)
        The Authentication FQCN to be used while creating the client from URI
      • getAuthenticationParams

        public String getAuthenticationParams()
      • setAuthenticationParams

        public void setAuthenticationParams​(String authenticationParams)
        The Authentication Parameters to be used while creating the client from URI