Pulsar
Send and receive messages to/from Apache Pulsar topics.
What’s inside
-
Pulsar component, URI syntax:
pulsar:persistence://tenant/namespace/topic
Please refer to the above links for usage and configuration details.
Maven coordinates
<dependency>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-pulsar-starter</artifactId>
</dependency> Spring Boot Auto-Configuration
The starter supports 54 options, which are listed below.
| Name | Description | Default | Type |
|---|---|---|---|
camel.component.pulsar.ack-group-time-millis | The time in milliseconds during which the consumer groups the acknowledgements before it sends them to the broker. 0 sends each acknowledgement at once. | 100 | Long |
camel.component.pulsar.ack-timeout-millis | The time in milliseconds after which a message that is not acknowledged is redelivered. 0 turns the timeout off; any other value must be at least 1000. | 10000 | Long |
camel.component.pulsar.ack-timeout-redelivery-backoff | A RedeliveryBackoff, such as a MultiplierRedeliveryBackoff, that gives the delay before a message whose ackTimeoutMillis expired is redelivered, from the number of times it was redelivered. Only used when ackTimeoutMillis is not 0. The option is a org.apache.pulsar.client.api.RedeliveryBackoff type. | RedeliveryBackoff | |
camel.component.pulsar.allow-manual-acknowledgement | Whether the route acknowledges the messages itself. When enabled, the consumer neither acknowledges nor negatively acknowledges a message after the route, and sets a PulsarMessageReceipt in the message_receipt header instead, to acknowledge the message with before ackTimeoutMillis expires. | false | Boolean |
camel.component.pulsar.authentication-class | The fully qualified class name of the Pulsar authentication plugin, such as org.apache.pulsar.client.impl.auth.AuthenticationToken. Only used together with authenticationParams, and not when a pulsarClient is given. | String | |
camel.component.pulsar.authentication-params | The parameters of the authentication plugin set in authenticationClass, as one string in the format that the plugin reads. Only used together with authenticationClass, and not when a pulsarClient is given. | String | |
camel.component.pulsar.auto-configuration | An AutoConfiguration that, when an endpoint is created, creates its tenant and namespace with the Pulsar admin client if they do not exist yet. A failure is only logged. The option is a org.apache.camel.component.pulsar.utils.AutoConfiguration type. | AutoConfiguration | |
camel.component.pulsar.autowired-enabled | Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | Boolean |
camel.component.pulsar.batcher-builder | Control batching method used by the producer. DEFAULT batches the messages together regardless of their key. KEY_BASED batches the messages of each key separately, so that a Key_Shared subscription spreads the keys over its consumers. A custom BatcherBuilder can be given as a bean reference. | default | BatcherBuilder |
camel.component.pulsar.batching-enabled | Whether the producer groups the messages into batches. Must be disabled to use chunkingEnabled. | true | Boolean |
camel.component.pulsar.batching-max-messages | The maximum number of messages in a batch. Currently not passed to the Pulsar client: the producer uses the maxPendingMessages value as the maximum number of messages in a batch. | 1000 | Integer |
camel.component.pulsar.batching-max-publish-delay-micros | The maximum time in microseconds that the producer holds the messages to send them in one batch, when batchingEnabled is true. Must be at least 1000 (1 millisecond). | 1000 | Long |
camel.component.pulsar.block-if-queue-full | Whether a send waits when the queue of pending messages (maxPendingMessages) is full, instead of failing with a ProducerQueueIsFullError. | false | Boolean |
camel.component.pulsar.bridge-error-handler | Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. Important: This is only possible if the 3rd party component allows Camel to be alerted if an exception was thrown. Some components handle this internally only, and therefore bridgeErrorHandler is not possible. In other situations we may improve the Camel component to hook into the 3rd party component and make this possible for future releases. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | Boolean |
camel.component.pulsar.chunking-enabled | Whether the producer splits a message that is larger than the maximum message size of the broker into chunks, which the consumer joins again. Requires batchingEnabled to be false, otherwise the producer fails to start. | false | Boolean |
camel.component.pulsar.compression-type | The compression type of the message payloads. | none | CompressionType |
camel.component.pulsar.configuration | Allows to pre-configure the Pulsar component with common options that the endpoints will reuse. The option is a org.apache.camel.component.pulsar.PulsarConfiguration type. | PulsarConfiguration | |
camel.component.pulsar.consumer-name | The name of the consumer with the EXCLUSIVE subscription type. The name identifies the consumer, for example in the topic stats. | sole-consumer | String |
camel.component.pulsar.consumer-name-prefix | The prefix of the consumer names with the SHARED, FAILOVER and KEY_SHARED subscription types. Each consumer is named the prefix followed by its index, starting at 0. | cons | String |
camel.component.pulsar.consumer-queue-size | The size of the receiver queue of each consumer: how many messages the consumer fetches from the broker ahead of processing them. 0 turns prefetching off. | 10 | Integer |
camel.component.pulsar.dead-letter-topic | The name of the dead letter topic. Only used when maxRedeliverCount is set. If not set, the Pulsar client uses topicName-subscriptionName-DLQ. | String | |
camel.component.pulsar.enable-batch-index-acknowledgment | When enabled, allows each individual message in a batch to be acknowledged independently. By default Pulsar redelivers the entire batch when any single message in the batch is not acknowledged. This option also requires the Pulsar broker to be configured with acknowledgmentAtBatchIndexLevelEnabled=true. | false | Boolean |
camel.component.pulsar.enable-retry | Whether to enable the retry letter topic mode of the Pulsar consumer: the consumer also subscribes to the retry letter topic, which receives the messages passed to Consumer.reconsumeLater. Camel itself negatively acknowledges a failed message and does not call reconsumeLater. If maxRedeliverCount is not set, the Pulsar client uses its default dead letter policy of 16 redeliveries. | false | Boolean |
camel.component.pulsar.enabled | Whether to enable auto configuration of the pulsar component. This is enabled by default. | Boolean | |
camel.component.pulsar.hashing-scheme | The hash function of the message key that chooses the partition of a message with a key, with the RoundRobinPartition and SinglePartition routing modes. | JavaStringHash | String |
camel.component.pulsar.hostname-verification | Whether to check that the certificate of the broker matches the host Camel connects to, with pulsar+ssl://. When disabled, any certificate trusted by the client is accepted, whatever host it was issued for. Not used when a pulsarClient is given. | true | Boolean |
camel.component.pulsar.initial-sequence-id | The first message published will have a sequence Id of initialSequenceId plus one. The default -1 leaves it to the Pulsar client, which continues after the last sequence id the broker has for the producer name. | -1 | Long |
camel.component.pulsar.key-shared-policy | The key shared policy of the consumers, for the KEY_SHARED subscription type. AUTO_SPLIT has the broker split the hash range of the message keys over the consumers. STICKY needs hash ranges assigned to each consumer, which Camel does not set, so the Pulsar client rejects it and the consumer fails to start. | String | |
camel.component.pulsar.lazy-start-producer | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. | false | Boolean |
camel.component.pulsar.max-pending-messages | The maximum number of sent messages that wait for the acknowledgement of the broker. When the queue is full, a send fails, unless blockIfQueueFull is enabled. 0 means no limit. Must not be greater than maxPendingMessagesAcrossPartitions. | 1000 | Integer |
camel.component.pulsar.max-redeliver-count | The number of redeliveries after which a message is sent to the dead letter topic instead. Must be greater than 0. If not set, Camel creates no dead letter policy, and deadLetterTopic and retryLetterTopic are not used. | Integer | |
camel.component.pulsar.message-listener | Whether the Pulsar client delivers the messages to a message listener, on the listener threads of the client, or Camel receives them with a thread pool of its own of numberOfConsumerThreads threads for each consumer. | true | Boolean |
camel.component.pulsar.message-router | A custom MessageRouter that chooses the partition of a partitioned topic for each message. When set, messageRoutingMode is not used. The option is a org.apache.pulsar.client.api.MessageRouter type. | MessageRouter | |
camel.component.pulsar.message-routing-mode | How the producer chooses the partition of a partitioned topic for a message without a key: RoundRobinPartition spreads the messages over all the partitions, SinglePartition sends them all to one partition picked at random, and CustomPartition uses the messageRouter, which it requires. A message with a key goes to the partition given by the hash of its key (hashingScheme). Not used when messageRouter is set. | roundrobinpartition | MessageRoutingMode |
camel.component.pulsar.negative-ack-redelivery-backoff | A RedeliveryBackoff, such as a MultiplierRedeliveryBackoff, that gives the delay before a negatively acknowledged message is redelivered, from the number of times it was redelivered. When set, negativeAckRedeliveryDelayMicros is not used. The option is a org.apache.pulsar.client.api.RedeliveryBackoff type. | RedeliveryBackoff | |
camel.component.pulsar.negative-ack-redelivery-delay-micros | The delay in microseconds before a message that failed in the route (negatively acknowledged) is redelivered. The default is 1 minute. Not used when negativeAckRedeliveryBackoff is set. | 60000000 | Long |
camel.component.pulsar.number-of-consumer-threads | The number of threads that receive and process the messages of each consumer, when messageListener is disabled. | 1 | Integer |
camel.component.pulsar.number-of-consumers | The number of Pulsar consumers to subscribe with the SHARED, FAILOVER and KEY_SHARED subscription types. The EXCLUSIVE subscription type always uses one consumer. | 1 | Integer |
camel.component.pulsar.producer-name | Name of the producer. If unset, lets Pulsar select a unique identifier. | String | |
camel.component.pulsar.pulsar-client | The Pulsar client that all the endpoints use. When set, the endpoints do not create a client of their own, and serviceUrl, the authentication options and the TLS options are not used. The option is a org.apache.pulsar.client.api.PulsarClient type. | PulsarClient | |
camel.component.pulsar.pulsar-message-receipt-factory | A factory that creates the PulsarMessageReceipt set in the message_receipt header when allowManualAcknowledgement is enabled, to provide an implementation other than the default. The option is a org.apache.camel.component.pulsar.PulsarMessageReceiptFactory type. | PulsarMessageReceiptFactory | |
camel.component.pulsar.read-compacted | Whether to read the compacted topic instead of its full backlog, so that up to the point of the last compaction only the latest message of each key is received. Only for persistent topics with the EXCLUSIVE or FAILOVER subscription type: with SHARED or KEY_SHARED the subscribe fails. | false | Boolean |
camel.component.pulsar.retry-letter-topic | The name of the retry letter topic. Only used when enableRetry is enabled and maxRedeliverCount is set. If not set, the Pulsar client uses topicName-subscriptionName-RETRY. | String | |
camel.component.pulsar.send-timeout-ms | The time in milliseconds within which the broker must acknowledge a sent message, otherwise the send fails. 0 means no timeout. | 30000 | Integer |
camel.component.pulsar.service-url | The Pulsar service URL to connect to, such as pulsar://localhost:6650, or pulsar+ssl://host:6651 for TLS. Not used when a pulsarClient is given. | String | |
camel.component.pulsar.subscription-initial-position | Where a new subscription starts: LATEST at the next message published, EARLIEST at the oldest message kept in the topic. Not used when the subscription already exists. | latest | SubscriptionInitialPosition |
camel.component.pulsar.subscription-mode | Determines the subscription mode for the consumer. Durable subscriptions persist the cursor position if the consumer disconnects while non-durable subscriptions do not. | durable | SubscriptionMode |
camel.component.pulsar.subscription-name | The name of the subscription. The broker creates the subscription when it does not exist yet. | subs | String |
camel.component.pulsar.subscription-topics-mode | Which topics a topicsPattern subscription covers: the persistent topics, the non-persistent topics, or all topics. Only used when topicsPattern is enabled. | persistentonly | RegexSubscriptionMode |
camel.component.pulsar.subscription-type | The subscription type. EXCLUSIVE allows a single consumer on the subscription. SHARED spreads the messages over the consumers. FAILOVER delivers the messages to one active consumer, and the others take over when it disconnects. KEY_SHARED spreads the messages over the consumers by key, the messages of a key going to the same consumer. | exclusive | SubscriptionType |
camel.component.pulsar.tls-trust-certs-file-path | The path of a PEM file with the certificates of the certificate authorities to trust, for a broker on pulsar+ssl:// whose certificate is not signed by an authority that the JVM trusts. Not used when a pulsarClient is given. | String | |
camel.component.pulsar.topics-pattern | Whether the topic of the endpoint URI is a regular expression. The consumer then subscribes to all the topics of the namespace whose name matches it, also to the topics created later. | false | Boolean |
camel.component.pulsar.allow-java-serialized-object | Whether the producer sends a body that does not convert to a byte array (such as a Map, a List, a number or a POJO) with Java serialization, as Camel did before 4.24. Such a message can only be read by a Java client that deserializes it. By default the producer fails such a body: marshal it first, for example to JSON. Deprecation note: Java serialization of the body is kept only for compatibility, and will be removed: marshal the body before sending it | false | Boolean |
camel.component.pulsar.max-pending-messages-across-partitions | The maximum number of pending messages across all the partitions of a partitioned topic, each partition having its own queue of pending messages. The maxPendingMessages value is reduced if (number of partitions * maxPendingMessages) exceeds this value. Must be at least maxPendingMessages. | 50000 | Integer |