diff --git a/.github/workflows/pr-tests.yaml b/.github/workflows/pr-tests.yaml index 92ad8fd..5762171 100644 --- a/.github/workflows/pr-tests.yaml +++ b/.github/workflows/pr-tests.yaml @@ -58,7 +58,7 @@ jobs: ./scripts/test - name: Upload coverage to Codecov - uses: codecov/codecov-action@v4.4.0 + uses: codecov/codecov-action@v4.5.0 with: file: ./coverage.xml name: kstreams diff --git a/docs/backends.md b/docs/backends.md index 1e1e394..5ee9724 100644 --- a/docs/backends.md +++ b/docs/backends.md @@ -9,4 +9,4 @@ with the backend. options: show_root_heading: true docstring_section_style: table - show_bases: false \ No newline at end of file + show_bases: false diff --git a/kstreams/backends/kafka.py b/kstreams/backends/kafka.py index 077574a..06cef27 100644 --- a/kstreams/backends/kafka.py +++ b/kstreams/backends/kafka.py @@ -27,11 +27,38 @@ class Kafka(BaseModel): It uses pydantic internally. !!! Example - ```python + ```python title="Backend with PLAINTEXT" from kstreams.backends.kafka import Kafka from kstreams import create_engine, Stream - backend = Kafka(bootstrap_servers=["localhost:8082"]) + backend = Kafka(bootstrap_servers=["localhost:9092"]) + stream_engine = create_engine(title="my-stream-engine", backend=backend) + ``` + + !!! Example + ```python title="Backend with SSL" + import ssl + + from kstreams.backends.kafka import Kafka + from kstreams import create_engine, utils, Stream + + + def get_ssl_context() -> ssl.SSLContext: + # SSL context can also be created from mem: + # https://kpn.github.io/kstreams/utils/#kstreams.utils.create_ssl_context_from_mem + return utils.create_ssl_context( + certdata="path/to/client-certificate", + keydata="path/to/client-private-key", + cadata="path/to/ca-bundle", # Default None + password="password-to-load-certificate-chain" # Default None + ) + + backend = Kafka( + bootstrap_servers=["localhost:9094"], + security_protocol="SSL", + ssl_context=get_ssl_context(), + ) + stream_engine = create_engine(title="my-stream-engine", backend=backend) ```