ApacheKafkaCommitter
Commit documents to Apache Kafka.
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.
- YAML
- JSON
- XML
class: ApacheKafkaCommitter
bootstrapServers: http://some_host:1234
topicName: my-topic
{
"class": "ApacheKafkaCommitter",
"bootstrapServers": "http://some_host:1234",
"topicName": "my-topic"
}
<committer>
<class>ApacheKafkaCommitter</class>
<bootstrapServers>http://some_host:1234</bootstrapServers>
<topicName>my-topic</topicName>
</committer>
The following example signs in to a secured cluster with SASL over TLS, with the password kept encrypted.
- YAML
- JSON
- XML
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
{
"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"
}
}
}
<class>ApacheKafkaCommitter</class>
<bootstrapServers>broker1:9093,broker2:9093</bootstrapServers>
<topicName>my-topic</topicName>
<securityProtocol>SASL_SSL</securityProtocol>
<saslMechanism>SCRAM_SHA_512</saslMechanism>
<credentials>
<username>crawler</username>
<password>${kafkaPassword}</password>
<passwordKey>
<source>ENVIRONMENT</source>
<value>MY_KEY_VAR</value>
</passwordKey>
</credentials>
Usage
Full configuration skeleton, with every option and its default
- YAML
- JSON
- XML
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
{
"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"
}
<apacheKafkaCommitter>
<class>ApacheKafkaCommitter</class>
<acl>
<flatPrefix>string</flatPrefix>
<format>NATIVE</format>
<partial>REJECT</partial>
</acl>
<bootstrapServers>string</bootstrapServers>
<createTopic>false</createTopic>
<credentials>
<password>string</password>
<passwordKey>
<size>0</size>
<source>KEY</source>
<value>string</value>
</passwordKey>
<username>string</username>
</credentials>
<fieldMappings/>
<partitions>0</partitions>
<queue>
<class>FsQueue</class>
<batchSize>0</batchSize>
<commitLeftoversOnInit>false</commitLeftoversOnInit>
<maxPerFolder>0</maxPerFolder>
<onCommitFailure/>
</queue>
<replicationFactor>0</replicationFactor>
<restrictions>
<restriction>
<fieldMatcher/>
<valueMatcher/>
</restriction>
</restrictions>
<saslMechanism>PLAIN</saslMechanism>
<securityProtocol>PLAINTEXT</securityProtocol>
<topicName>string</topicName>
</apacheKafkaCommitter>
Properties
| Property | Type | Required | Default |
|---|---|---|---|
acl | AclCommitterConfig | No | AclCommitterConfig |
bootstrapServers | string | No | - |
createTopic | boolean | No | false |
credentials | Credentials | No | Credentials |
fieldMappings | Record<string, string> | No | - |
partitions | integer | No | 0 |
queue | CommitterQueue | No | FsQueue |
replicationFactor | integer | No | 0 |
restrictions | PropertyMatcher[] | No | - |
saslMechanism | enum | No | - |
securityProtocol | enum | No | - |
topicName | string | No | - |
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:JSONsends the field as it is;FLATreplaces it with plain fields (below);NATIVEwrites it as the destination's own access control, for committers whose destination has one;NONEdoes not send it. When not set, the committer's default applies (NATIVEwhere available, otherwiseJSON).partial: what to do with a document whose permissions could only be read in part:REJECT(the default) orSEND.flatPrefix: the prefix of theFLATfields. Default isacl.
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
PLAINSCRAM_SHA_256SCRAM_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
PLAINTEXTSSLSASL_PLAINTEXTSASL_SSL
topicName
The Kafka topic name to possibly create and use as the target for storing documents.