Skip to main content

ApacheKafkaCommitter

Commit documents to Apache Kafka.

committer/apachekafkaJavadoc: ApacheKafkaCommitter

Notes​

Commits crawled documents to an Apache Kafka topic. Supports optional topic creation, field mappings to Kafka fields, and configurable partition and replication settings.

Interoperability note:

  • ApacheKafkaCommitter provides Kafka-based interoperability out of the box by publishing crawl output to an open event bus.
  • This allows downstream integration with a wide range of systems through Kafka-native consumers and connector ecosystems.
  • Downstream behavior (for example schema mapping, delete semantics, idempotency, and ACL handling) depends on the target consumer/connector configuration and capabilities.

Examples​

The following example uses the minimum required settings to configure Apache Kafka Committer. The Kafka topic won't be created. As such, the topic must already exist in Apache Kafka.

class: ApacheKafkaCommitter
bootstrapServers: http://some_host:1234
topicName: my-topic

The following example signs in to a secured cluster with SASL over TLS, with the password kept encrypted.

class: ApacheKafkaCommitter
bootstrapServers: broker1:9093,broker2:9093
topicName: my-topic
securityProtocol: SASL_SSL
saslMechanism: SCRAM_SHA_512
credentials:
username: crawler
password: ${kafkaPassword}
passwordKey:
source: ENVIRONMENT
value: MY_KEY_VAR

Usage​

Full configuration skeleton, with every option and its default
class: ApacheKafkaCommitter
acl:
flatPrefix: string
format: NATIVE
partial: REJECT
bootstrapServers: string
createTopic: false
credentials:
password: string
passwordKey:
size: 0
source: KEY
value: string
username: string
fieldMappings: {}
partitions: 0
queue:
class: FsQueue
batchSize: 0
commitLeftoversOnInit: false
maxPerFolder: 0
onCommitFailure:
ignoreErrors: false
maxRetries: 0
retryDelay: 0
splitBatch: OFF
replicationFactor: 0
restrictions:
- fieldMatcher: {}
valueMatcher: {}
saslMechanism: PLAIN
securityProtocol: PLAINTEXT
topicName: string

Properties​

PropertyTypeRequiredDefault
aclAclCommitterConfigNoAclCommitterConfig
bootstrapServersstringNo-
createTopicbooleanNofalse
credentialsCredentialsNoCredentials
fieldMappingsRecord<string, string>No-
partitionsintegerNo0
queueCommitterQueueNoFsQueue
replicationFactorintegerNo0
restrictionsPropertyMatcher[]No-
saslMechanismenumNo-
securityProtocolenumNo-
topicNamestringNo-

Property Details​

acl​

How this committer sends the access control list (ACL) a document carries in its crawler.acl field, written by the fetchers that read a source's permissions:

  • format: JSON sends the field as it is; FLAT replaces it with plain fields (below); NATIVE writes it as the destination's own access control, for committers whose destination has one; NONE does not send it. When not set, the committer's default applies (NATIVE where available, otherwise JSON).
  • partial: what to do with a document whose permissions could only be read in part: REJECT (the default) or SEND.
  • flatPrefix: the prefix of the FLAT fields. Default is acl.

A document whose permissions cannot be vouched for is withheld: it is not sent, a version sent before is removed from the destination, and the crawler tries it again on its next run. That is the case when its ACL is partial and partial is REJECT, when its permissions could not be read at all, when the ACL is unreadable or of an unknown version, or when NATIVE cannot express it. A withheld document is never sent as readable by everyone.

With FLAT, acl.levels names the checks a person must pass, in order, and each level has an allow field and a deny field holding principals as kind:dir:id (or special:id):

acl.levels = share, file
acl.share.allow = group:ad:CORP:Sales
acl.file.allow = group:ad:CORP:Sales
acl.file.deny = group:ad:CORP:Interns
acl.owners = user:ad:CORP:pascal

A person may see the document if they match an allow value of every level and no deny value of any.

bootstrapServers​

A list of host/port pairs in the form host1:port1,host2:port2,... to use for establishing a connection to the Kafka cluster.

createTopic​

Create the "Topic Name" in Kafka if it does not exist already.

credentials​

The user name and password to sign in with when securityProtocol is SASL_PLAINTEXT or SASL_SSL. The password can be encrypted, so it stays out of the configuration.

fieldMappings​

Mapping of source fields to target ones (Kafka fields).

partitions​

Number of partitions set at topic creation.

queue​

Configures the committer queue used to batch documents before sending them to the target system. Adjust queue settings to tune throughput and memory usage.

replicationFactor​

Replication factor set at topic creation.

restrictions​

Defines filter conditions that restrict which documents this committer processes. Documents not matching the restrictions are ignored by this committer.

saslMechanism​

How the client signs in when securityProtocol is SASL_PLAINTEXT or SASL_SSL: PLAIN (default), SCRAM_SHA_256 or SCRAM_SHA_512.

Allowed Values​

  • PLAIN
  • SCRAM_SHA_256
  • SCRAM_SHA_512

securityProtocol​

How the client connects to the brokers: PLAINTEXT (the Kafka default, no encryption and no sign-in), SSL (encrypted with TLS), SASL_PLAINTEXT (sign-in, not encrypted) or SASL_SSL (sign-in, encrypted). The sign-in uses credentials.

Allowed Values​

  • PLAINTEXT
  • SSL
  • SASL_PLAINTEXT
  • SASL_SSL

topicName​

The Kafka topic name to possibly create and use as the target for storing documents.