Kafka

Kafka

Description: Camel Kafka support
Scheme: kafka
Syntax: kafka:brokers
Maven: org.apache.camel/camel-kafka/2.16.1
Name Kind Group Required Default Type Enum Description
brokers path common java.lang.String This is for bootstrapping and the producer will only use it for getting metadata (topics, partitions and replicas). The socket connections for sending the actual data will be established based on the broker information returned in the metadata. The format is host1:port1,host2:port2, and the list can be a subset of brokers or a VIP pointing to a subset of brokers.

This option is known as metadata.broker.list in the Kafka documentation.

bridgeEndpoint parameter common false boolean If the option is true, then KafkaProducer will ignore the KafkaConstants.TOPIC header setting of the inbound message.
clientId parameter common java.lang.String The client id is a user-specified string sent in each request to help trace calls. It should logically identify the application making the request.
groupId parameter common java.lang.String A string that uniquely identifies the group of consumer processes to which this consumer belongs. By setting the same group id multiple processes indicate that they are all part of the same consumer group.
partitioner parameter common DefaultPartitioner java.lang.String The partitioner class for partitioning messages amongst sub-topics. The default partitioner is based on the hash of the key.
topic parameter common true java.lang.String Name of the topic to use
zookeeperConnect parameter common java.lang.String Specifies the ZooKeeper connection string in the form hostname:port where host and port are the host and port of a ZooKeeper server. To allow connecting through other ZooKeeper nodes when that ZooKeeper machine is down you can also specify multiple hosts in the form hostname1:port1,hostname2:port2,hostname3:port3. The server may also have a ZooKeeper chroot path as part of it's ZooKeeper connection string which puts its data under some path in the global ZooKeeper namespace. If so the consumer should use the same chroot path in its connection string. For example to give a chroot path of /chroot/path you would give the connection string as hostname1:port1,hostname2:port2,hostname3:port3/chroot/path.
zookeeperConnectionTimeoutMs parameter common java.lang.Integer The max time that the client waits while establishing a connection to zookeeper.
zookeeperHost parameter common java.lang.String The zookeeper host to use.

To connect to multiple zookeeper hosts use the zookeeperConnect option instead.

This option can only be used if zookeeperConnect is not in use.

zookeeperPort parameter common 2181 int The zookeeper port to use

To connect to multiple zookeeper hosts use the zookeeperConnect option instead.

This option can only be used if zookeeperConnect is not in use.

zookeeperSessionTimeoutMs parameter common java.lang.Integer ZooKeeper session timeout. If the consumer fails to heartbeat to ZooKeeper for this period of time it is considered dead and a rebalance will occur.
zookeeperSyncTimeMs parameter common java.lang.Integer How far a ZK follower can be behind a ZK leader
autoCommitEnable parameter consumer true java.lang.Boolean If true, periodically commit to ZooKeeper the offset of messages already fetched by the consumer. This committed offset will be used when the process fails as the position from which the new consumer will begin.
autoCommitIntervalMs parameter consumer 60000 java.lang.Integer The frequency in ms that the consumer offsets are committed to zookeeper.
autoOffsetReset parameter consumer largest java.lang.String smallest
largest
fail
What to do when there is no initial offset in ZooKeeper or if an offset is out of range: smallest : automatically reset the offset to the smallest offset largest : automatically reset the offset to the largest offset fail: throw exception to the consumer
barrierAwaitTimeoutMs parameter consumer 10000 int If the BatchingConsumerTask processes exchange exceed the batchSize, it will wait for barrierAwaitTimeoutMs.
batchSize parameter consumer 100 int The batchSize that the BatchingConsumerTask processes once.
consumerId parameter consumer java.lang.String Generated automatically if not set.
consumersCount parameter consumer 1 int The number of consumers that connect to kafka server
consumerStreams parameter consumer 10 int Number of concurrent consumers on the consumer
consumerTimeoutMs parameter consumer java.lang.Integer Throw a timeout exception to the consumer if no message is available for consumption after the specified interval
dualCommitEnabled parameter consumer true java.lang.Boolean If you are using "kafka" as offsets.storage, you can dual commit offsets to ZooKeeper (in addition to Kafka). This is required during migration from zookeeper-based offset storage to kafka-based offset storage. With respect to any given consumer group, it is safe to turn this off after all instances within that group have been migrated to the new version that commits offsets to the broker (instead of directly to ZooKeeper).
fetchMessageMaxBytes parameter consumer 1048576 java.lang.Integer The number of byes of messages to attempt to fetch for each topic-partition in each fetch request. These bytes will be read into memory for each partition, so this helps control the memory used by the consumer. The fetch request size must be at least as large as the maximum message size the server allows or else it is possible for the producer to send messages larger than the consumer can fetch.
fetchMinBytes parameter consumer 1 java.lang.Integer The minimum amount of data the server should return for a fetch request. If insufficient data is available the request will wait for that much data to accumulate before answering the request.
fetchWaitMaxMs parameter consumer 100 java.lang.Integer The maximum amount of time the server will block before answering the fetch request if there isn't sufficient data to immediately satisfy fetch.min.bytes
offsetsStorage parameter consumer zookeeper java.lang.String zookeeper
kafka
Select where offsets should be stored (zookeeper or kafka).
queuedMaxMessageChunks parameter consumer 2 java.lang.Integer Max number of message chunks buffered for consumption. Each chunk can be up to fetch.message.max.bytes.
rebalanceBackoffMs parameter consumer 2000 java.lang.Integer Backoff time between retries during rebalance.
rebalanceMaxRetries parameter consumer 4 java.lang.Integer When a new consumer joins a consumer group the set of consumers attempt to "rebalance" the load to assign partitions to each consumer. If the set of consumers changes while this assignment is taking place the rebalance will fail and retry. This setting controls the maximum number of attempts before giving up.
refreshLeaderBackoffMs parameter consumer 200 java.lang.Integer Backoff time to wait before trying to determine the leader of a partition that has just lost its leader.
socketReceiveBufferBytes parameter consumer 65536 java.lang.Integer The socket receive buffer for network requests
socketTimeoutMs parameter consumer 30000 java.lang.Integer The socket timeout for network requests. The actual timeout set will be max.fetch.wait + socket.timeout.ms.
batchNumMessages parameter producer 200 java.lang.Integer The number of messages to send in one batch when using async mode. The producer will wait until either this number of messages are ready to send or queue.buffer.max.ms is reached.
compressedTopics parameter producer java.lang.String This parameter allows you to set whether compression should be turned on for particular topics. If the compression codec is anything other than NoCompressionCodec, enable compression only for specified topics if any. If the list of compressed topics is empty, then enable the specified compression codec for all topics. If the compression codec is NoCompressionCodec, compression is disabled for all topics
compressionCodec parameter producer none java.lang.String none
gzip
snappy
This parameter allows you to specify the compression codec for all data generated by this producer. Valid values are "none", "gzip" and "snappy".
keySerializerClass parameter producer java.lang.String The serializer class for keys (defaults to the same as for messages if nothing is given).
messageSendMaxRetries parameter producer 3 java.lang.Integer This property will cause the producer to automatically retry a failed send request. This property specifies the number of retries when such failures occur. Note that setting a non-zero value here can lead to duplicates in the case of network errors that cause a message to be sent but the acknowledgement to be lost.
producerType parameter producer sync java.lang.String async
sync
This parameter specifies whether the messages are sent asynchronously in a background thread. Valid values are (1) async for asynchronous send and (2) sync for synchronous send. By setting the producer to async we allow batching together of requests (which is great for throughput) but open the possibility of a failure of the client machine dropping unsent data.
queueBufferingMaxMessages parameter producer 10000 java.lang.Integer The maximum number of unsent messages that can be queued up the producer when using async mode before either the producer must be blocked or data must be dropped.
queueBufferingMaxMs parameter producer 5000 java.lang.Integer Maximum time to buffer data when using async mode. For example a setting of 100 will try to batch together 100ms of messages to send at once. This will improve throughput but adds message delivery latency due to the buffering.
queueEnqueueTimeoutMs parameter producer java.lang.Integer The amount of time to block before dropping messages when running in async mode and the buffer has reached queue.buffering.max.messages. If set to 0 events will be enqueued immediately or dropped if the queue is full (the producer send call will never block). If set to -1 the producer will block indefinitely and never willingly drop a send.
requestRequiredAcks parameter producer 0 short This value controls when a produce request is considered completed. Specifically, how many other brokers must have committed the data to their log and acknowledged this to the leader? Typical values are (0, 1 or -1): 0, which means that the producer never waits for an acknowledgement from the broker (the same behavior as 0.7). This option provides the lowest latency but the weakest durability guarantees (some data will be lost when a server fails). 1, which means that the producer gets an acknowledgement after the leader replica has received the data. This option provides better durability as the client waits until the server acknowledges the request as successful (only messages that were written to the now-dead leader but not yet replicated will be lost). -1, The producer gets an acknowledgement after all in-sync replicas have received the data. This option provides the greatest level of durability. However, it does not completely eliminate the risk of message loss because the number of in sync replicas may, in rare cases, shrink to 1. If you want to ensure that some minimum number of replicas (typically a majority) receive a write, then you must set the topic-level min.insync.replicas setting. Please read the Replication section of the design documentation for a more in-depth discussion.
requestTimeoutMs parameter producer 10000 java.lang.Integer The amount of time the broker will wait trying to meet the request.required.acks requirement before sending back an error to the client.
retryBackoffMs parameter producer 100 java.lang.Integer Before each retry, the producer refreshes the metadata of relevant topics to see if a new leader has been elected. Since leader election takes a bit of time, this property specifies the amount of time that the producer waits before refreshing the metadata.
sendBufferBytes parameter producer 102400 java.lang.Integer Socket write buffer size
serializerClass parameter producer java.lang.String The serializer class for messages. The default encoder takes a byte[] and returns the same byte[]. The default class is kafka.serializer.DefaultEncoder
topicMetadataRefreshIntervalMs parameter producer 600000 java.lang.Integer The producer generally refreshes the topic metadata from brokers when there is a failure (partition missing, leader not available...). It will also poll regularly (default: every 10min so 600000ms). If you set this to a negative value, metadata will only get refreshed on failure. If you set this to zero, the metadata will get refreshed after each message sent (not recommended). Important note: the refresh happen only AFTER the message is sent, so if the producer never sends a message the metadata is never refreshed
exchangePattern parameter advanced InOnly org.apache.camel.ExchangePattern InOnly
RobustInOnly
InOut
InOptionalOut
OutOnly
RobustOutOnly
OutIn
OutOptionalIn
Sets the default exchange pattern when creating an exchange
synchronous parameter advanced false boolean Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported).

kafka consumer