Dependencies & cluster requirements
Dependencies & cluster requirements
Dependencies:
- ProphecySparkBasicsPython 0.2.49+
- ProphecySparkBasicsScala 0.0.1+
- ProphecyLibsPython 1.9.24+
- UC dedicated clusters not supported
- UC standard clusters 14.3+ supported
- Livy clusters not supported
Source
The Source gem reads data from Kafka stream in batch mode and allows you to optionally specify the following additional properties. This means that Kafka only reads data incrementally from the last offset stored in the specified Metadata table. If the Metadata table is not present, then Kafka reads data from theearliest offset.
Source location
Source properties
Example

Compiled code
Target
The Target gem writes data to each row from theDataframe to a Kafka topic as JSON messages and allows you to optionally specify the following additional properties.
Target location
Target properties
Example

Compiled code
Example Pipeline
Source Pipeline Example
In this example, you read JSON messages from Kafka, parse them, remove any null messages, and persist the data to a Delta table.
Metadata Table
To avoid reprocessing messages on subsequent pipeline runs, update a table with the last processed offsets for each Kafka partition and topic. When you run the pipeline, the table only gets a batch of messages that arrived since the previously-processed offset. In this example, you updatemetadata.kafka_offsets, which has the following structure:
Taking this approach provides you the with following benefits:
- Builds the pipeline interactively without committing any offsets.
- Production workflows only consume messages that arrived since the previously-processed offset.
- You can replay old messages by modifying the Metadata table.
For production workflows the phase for the
Script gem that updates
the offsets should be greater than the phase of the Target gem. This ensures that offsets only
update in the table after Prophecy safely persists the data to the Target.
