-
Notifications
You must be signed in to change notification settings - Fork 4
Fill docs with content #392
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
vostres
wants to merge
9
commits into
feature/docs-toc
Choose a base branch
from
feature/docs-content
base: feature/docs-toc
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
9671f66
Add content
vostres 24eca85
Apply suggestions from code review
vostres 30fe5b0
Implement review (part 1)
vostres 1cb4a4a
Implement review (part 2)
vostres 7b93833
Wip
vostres c39e9f1
Wip
vostres 7433b28
Remove "framework"
vostres 27b14d9
Wip
vostres f234d69
Wip
vostres File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,41 @@ | ||
| # What is streams-bootstrap? | ||
|
|
||
| `streams-bootstrap` is a Java library that standardizes the development and operation of Kafka-based applications (Kafka | ||
| Streams and plain Kafka clients). | ||
|
|
||
| The framework supports Apache Kafka 4.1 and Java 17. Its modules are published to Maven Central for straightforward | ||
| integration into existing projects. | ||
|
|
||
| ## Why use it? | ||
|
|
||
| Kafka Streams and the core Kafka clients provide strong primitives for stream processing and messaging, but they do not | ||
| prescribe: | ||
|
|
||
| - How to structure a full application around those primitives | ||
| - How to configure applications consistently | ||
| - How to deploy and operate these services on Kubernetes | ||
| - How to perform repeatable reprocessing and cleanup | ||
| - How to handle errors and large messages uniformly | ||
|
|
||
| `streams-bootstrap` addresses these aspects by supplying: | ||
|
|
||
| 1. **Standardized base classes** for Kafka Streams and client applications. | ||
| 2. **A common CLI/configuration contract** for all Kafka applications. | ||
| 3. **Helm-based deployment templates** and conventions for Kubernetes. | ||
| 4. **Built-in reset/clean workflows** for reprocessing and state management. | ||
| 5. **Consistent error-handling** and dead-letter integration. | ||
| 6. **Testing infrastructure** for local development and CI environments. | ||
| 7. **Optional blob-storage-backed serialization** for large messages. | ||
|
|
||
| ## Architecture | ||
|
|
||
| The framework uses a modular architecture with a clear separation of concerns. | ||
|
|
||
| ### Core Modules | ||
|
|
||
| - `streams-bootstrap-core`: Core abstractions for application lifecycle, execution, and cleanup | ||
| - `streams-bootstrap-cli`: CLI framework based on `picocli` | ||
| - `streams-bootstrap-test`: Utilities for testing streams-bootstrap applications | ||
| - `streams-bootstrap-large-messages`: Support for handling large Kafka messages | ||
| - `streams-bootstrap-cli-test`: Test support for CLI-based applications | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,155 @@ | ||
| # Producer apps | ||
| # Producer applications | ||
|
|
||
| Producer apps are applications that generate data and send it to a Kafka topic. | ||
| They can be used to produce messages from various sources, such as databases, files, or real-time events. | ||
| Producer applications generate data and send it to Kafka topics. They can be used to produce messages from various | ||
| sources, such as databases, files, or real-time events. | ||
|
|
||
| streams-bootstrap provides a structured way to build producer applications with consistent configuration handling, | ||
| command-line support, and lifecycle management. | ||
|
|
||
| --- | ||
|
|
||
| ## Application lifecycle | ||
|
|
||
| - Running an application | ||
| - Cleaning an application | ||
| ### Running an application | ||
|
|
||
| Producer applications are executed using the `ProducerRunner`, which runs the producer logic defined by the application. | ||
|
|
||
| Unlike Kafka Streams applications, producer applications typically: | ||
|
|
||
| - Run to completion and terminate automatically, or | ||
| - Run continuously when implemented as long-lived services | ||
|
|
||
| The execution model is fully controlled by the producer implementation and its runnable logic. | ||
|
|
||
| --- | ||
|
|
||
| ### Cleaning an application | ||
|
|
||
| Producer applications support a dedicated `clean` command. | ||
|
|
||
| ```bash | ||
| java -jar my-producer-app.jar \ | ||
| --bootstrap-servers localhost:9092 \ | ||
| --output-topic my-topic \ | ||
| clean | ||
| ``` | ||
|
|
||
| The clean process can perform the following operations: | ||
|
|
||
| - Delete output topics | ||
| - Delete registered schemas from Schema Registry | ||
| - Execute custom cleanup hooks defined by the application | ||
|
|
||
| Applications can register custom cleanup logic by overriding `setupCleanUp`. | ||
|
|
||
| --- | ||
|
|
||
| ## Configuration | ||
|
|
||
| ### Serialization configuration | ||
|
|
||
| Producer applications define key and value serialization using the `defaultSerializationConfig()` method in their | ||
| `ProducerApp` implementation. | ||
|
|
||
| ```java | ||
|
|
||
| @Override | ||
| public SerializerConfig defaultSerializationConfig() { | ||
| return new SerializerConfig(StringSerializer.class, SpecificAvroSerializer.class); | ||
| } | ||
| ``` | ||
|
|
||
| ### Kafka properties | ||
|
|
||
| #### Base configuration | ||
|
|
||
| The following Kafka properties are configured by default for Producer applications in streams-bootstrap: | ||
|
|
||
| - `max.in.flight.requests.per.connection = 1` | ||
| - `acks = all` | ||
| - `compression.type = gzip` | ||
|
|
||
| #### Custom Kafka properties | ||
|
|
||
| Kafka configuration can be customized by overriding `createKafkaProperties()`: | ||
|
|
||
| ```java | ||
| @Override | ||
| public Map<String, Object> createKafkaProperties() { | ||
| return Map.of( | ||
| ProducerConfig.RETRIES_CONFIG, 3, | ||
| ProducerConfig.BATCH_SIZE_CONFIG, 16384, | ||
| ProducerConfig.LINGER_MS_CONFIG, 5 | ||
| ); | ||
| } | ||
| ``` | ||
|
|
||
| These properties are merged with defaults and CLI-provided configuration. | ||
|
|
||
| --- | ||
|
|
||
| ### Lifecycle hooks | ||
|
|
||
| Producer applications can register cleanup logic via `setupCleanUp`. This method allows you to attach: | ||
|
|
||
| - **Cleanup hooks** – for general cleanup logic not tied to Kafka topics | ||
| - **Topic hooks** – for reacting to topic lifecycle events (e.g. deletion) | ||
|
|
||
| #### Clean up | ||
|
|
||
| Custom cleanup logic that is not tied to Kafka topics can be registered via cleanup hooks: | ||
|
|
||
| ```java | ||
|
|
||
| @Override | ||
| public ProducerCleanUpConfiguration setupCleanUp( | ||
| final AppConfiguration<ProducerTopicConfig> configuration) { | ||
|
|
||
| return ProducerApp.super.setupCleanUp(configuration) | ||
| .registerCleanHook(() -> { | ||
| // Custom cleanup logic | ||
| }); | ||
| } | ||
| ``` | ||
|
|
||
| #### Topic hooks | ||
|
|
||
| Topic hooks should be used for topic-related cleanup or side effects, such as releasing external | ||
| resources associated with a topic or logging topic deletions: | ||
|
|
||
| ```java | ||
| @Override | ||
| public ProducerCleanUpConfiguration setupCleanUp( | ||
| final AppConfiguration<ProducerTopicConfig> configuration) { | ||
|
|
||
| return ProducerApp.super.setupCleanUp(configuration) | ||
| .registerTopicHook(new TopicHook() { | ||
|
|
||
| @Override | ||
| public void deleted(final String topic) { | ||
| // Called when a managed topic is deleted | ||
| System.out.println("Deleted topic: " + topic); | ||
| } | ||
|
|
||
| @Override | ||
| public void close() { | ||
| // Optional cleanup for the hook itself | ||
| } | ||
| }); | ||
| } | ||
| ``` | ||
|
|
||
| ## Command line interface | ||
|
|
||
| Producer applications inherit standard CLI options from `KafkaApplication`. The following CLI options are producer-specific: | ||
|
|
||
| | Option | Description | Default | | ||
| |---------------------------|--------------------------------------------------|---------| | ||
| | `--output-topic` | Default output topic | - | | ||
| | `--labeled-output-topics` | Named output topics (`label1=topic1,...`) | - | | ||
|
|
||
| --- | ||
|
|
||
| ## Deployment | ||
|
|
||
| TODO |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.