Apache Kafka Plugin
The Apache Kafka plugin (tika-pipes-kafka) provides an emitter (publishes parsed documents to a Kafka topic) and an iterator (consumes fetch requests from a Kafka topic).
| Interface | Component name | Class |
|---|---|---|
Emitter |
|
|
Iterator |
|
|
Kafka Emitter (kafka-emitter)
Publishes each parsed document as a record to a Kafka topic.
{
"emitters": {
"kafe": {
"kafka-emitter": {
"topic": "tika-parsed-docs",
"bootstrapServers": "kafka1.example.com:9092,kafka2.example.com:9092",
"acks": "all",
"lingerMs": 5000,
"batchSize": 16384,
"compressionType": "lz4",
"enableIdempotence": true,
"maxRequestSize": 1048576,
"requestTimeoutMs": 30000,
"deliveryTimeoutMs": 120000,
"clientId": "tika-pipes-emitter"
}
}
}
}
Configuration
Fields map onto standard Kafka producer settings. Tika supplies no values of its own: an absent field is omitted from the producer properties, so the Kafka client’s own default applies. The Default column below is therefore the Kafka client’s default.
| Field | Default | Description |
|---|---|---|
|
required |
Kafka topic to publish to (validated non-blank). |
|
required |
Comma-separated |
|
|
Producer acks: |
|
|
Producer linger, ms. |
|
|
Producer batch size, bytes. |
|
|
Producer buffer memory, bytes (32 MiB). |
|
|
One of |
|
ignored |
Accepted by the config parser but never passed to the producer, so it has no effect. Kafka’s own |
|
|
End-to-end delivery timeout. Must be at least |
|
|
Idempotent producer. Requires |
|
none |
Comma-separated list of producer interceptor class names. |
|
|
How long |
|
|
In-flight requests per connection. Must be at least |
|
|
Maximum request size, bytes (1 MiB). |
|
|
Metadata refresh interval. |
|
|
Request timeout. |
|
|
Producer retries, capped in practice by |
|
|
Backoff between retries. |
|
|
Transaction timeout; only meaningful with |
|
none |
Set to enable the transactional producer. |
|
none |
|
|
|
Fully-qualified serializer class names. Unset (or unloadable) falls back to |
Kafka Iterator (kafka-pipes-iterator)
Consumes fetch-request messages from a Kafka topic and emits one FetchEmitTuple per message. Useful for building event-driven pipelines where some upstream system pushes work to a queue.
{
"pipes-iterator": {
"kafka-pipes-iterator": {
"topic": "tika-fetch-requests",
"bootstrapServers": "kafka1.example.com:9092,kafka2.example.com:9092",
"groupId": "tika-pipes-iterator",
"autoOffsetReset": "earliest",
"pollDelayMs": 100,
"emitMax": -1,
"fetcherId": "fsf",
"emitterId": "kafe"
}
}
}
Configuration
In addition to the required fetcherId / emitterId (see Wiring an Iterator):
| Field | Default | Description |
|---|---|---|
|
required |
Kafka topic to consume from. |
|
required |
Broker list. |
|
none |
Kafka consumer group ID. Strongly recommended in production for failover and partition reassignment. |
|
|
Consumer deserializer class names. Unset (or unloadable) falls back to |
|
|
What to do on first connect: |
|
|
Sleep between |
|
|
Maximum tuples to emit. |
|
|
Initial rebalance delay for the consumer group. |
Complete Pipeline Example
A Kafka iterator (consuming fetch requests), a filesystem fetcher, and a Kafka emitter (publishing parsed results) — the stream-processing shape.
{
"content-handler-factory": {
"basic-content-handler-factory": {
"type": "TEXT",
"writeLimit": -1,
"throwOnWriteLimitReached": true
}
},
"fetchers": {
"fsf": {
"file-system-fetcher": {
"basePath": "/data/input",
"extractFileSystemMetadata": false
}
}
},
"emitters": {
"kafe": {
"kafka-emitter": {
"topic": "tika-parsed-docs",
"bootstrapServers": "kafka1.example.com:9092",
"acks": "all",
"compressionType": "lz4",
"enableIdempotence": true
}
}
},
"pipes-iterator": {
"kafka-pipes-iterator": {
"topic": "tika-fetch-requests",
"bootstrapServers": "kafka1.example.com:9092",
"groupId": "tika-pipes-iterator",
"autoOffsetReset": "earliest",
"fetcherId": "fsf",
"emitterId": "kafe"
}
},
"pipes": {
"parseMode": "RMETA",
"onParseException": "EMIT",
"numClients": 4
}
}
Notes
-
The Kafka plugin uses the official
kafka-clientsSDK. -
The emitter is fire-and-forget at the Tika level; durability is determined by Kafka’s
acksand broker replication factor, not by Tika. -
For exactly-once semantics, set
enableIdempotence: true(and ensureacks: all); for transactional semantics, also settransactionalId. -
The iterator’s
groupIdcontrols partition assignment. Set it explicitly in production — without one, the consumer receives a transient assignment that resets on restart.