Skip to content

Commit 02db2c7

Browse files
authored
Merge branch 'master' into json-schema-ssrf-guard
2 parents dede243 + 8b1c7a6 commit 02db2c7

105 files changed

Lines changed: 18273 additions & 203 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.formatignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,7 @@ tests/integration/schema_registry/data/proto/TestProto_pb2.py
1212
tests/integration/schema_registry/data/proto/common_proto_pb2.py
1313
tests/integration/schema_registry/data/proto/exampleProtoCriteo_pb2.py
1414
tests/integration/schema_registry/data/proto/metadata_proto_pb2.py
15+
16+
# Hand-maintained type stub. tools/style-format.sh runs clang-format on any
17+
# file that isn't .py, and that corrupts the stub. Keep it out.
18+
src/confluent_kafka/cimpl.pyi

.semaphore/semaphore.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ execution_time_limit:
88
global_job_config:
99
env_vars:
1010
- name: LIBRDKAFKA_VERSION
11-
value: v2.14.2
11+
value: v2.15.0
1212
prologue:
1313
commands:
1414
- checkout
@@ -203,6 +203,7 @@ blocks:
203203
- name: Build and Tests with 'classic' group protocol
204204
commands:
205205
- sem-version python 3.11
206+
- sem-version java 17
206207
- pip install uv
207208
# use a virtualenv
208209
- uv venv _venv --python "$(command -v python)" && source _venv/bin/activate
@@ -221,6 +222,7 @@ blocks:
221222
- name: Build, Test, and Report coverage
222223
commands:
223224
- sem-version python 3.11
225+
- sem-version java 17
224226
- pip install uv
225227
# use a virtualenv
226228
- uv venv _venv --python "$(command -v python)" && source _venv/bin/activate
@@ -245,6 +247,7 @@ blocks:
245247
commands:
246248
- export ARCH=arm64
247249
- sem-version python 3.11
250+
- sem-version java 17
248251
- pip install uv
249252
# use a virtualenv
250253
- uv venv _venv --python "$(command -v python)" && source _venv/bin/activate

CHANGELOG.md

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,48 @@
11
# Confluent Python Client for Apache Kafka - CHANGELOG
22

3-
## v2.xx.x
3+
## v2.15.0
4+
5+
### [KIP-932](https://cwiki.apache.org/confluence/display/KAFKA/KIP-932%3A+Queues+for+Kafka) Queues for Kafka – Now in **Preview**
6+
7+
confluent-kafka-python 2.15.0 adds a **Preview** implementation of the KIP-932 share consumer (Queues for Kafka). Members of a share group cooperatively consume from the same partitions with per-record acquire/acknowledge semantics and redelivery, providing queue-like consumption on top of Kafka.
8+
9+
- New `ShareConsumer` and `DeserializingShareConsumer` clients: subscribe, batch poll (`poll()` returns a `Messages` batch), and close (with context-manager support).
10+
- Implicit (default) and explicit acknowledgement modes (`share.acknowledgement.mode`), with `AcknowledgeType` ACCEPT / RELEASE / REJECT and `Message.delivery_count()`.
11+
- Synchronous and asynchronous commit (`commit_sync` / `commit_async`) and an acknowledgement-commit callback.
12+
- Runtime SASL credential updates (`set_sasl_credentials`) and new `IllegalStateException` / `ConcurrentModificationException` exceptions.
13+
- (#2217, #2239, #2241, #2252, #2253, #2265, #2273, #2277, #2279)
14+
15+
See the [Share Consumer guide](docs/kip-932-share-consumer.md) and the [Share consumers section of librdkafka's INTRODUCTION.md](https://github.com/confluentinc/librdkafka/blob/master/INTRODUCTION.md#share-consumers-queues-for-kafka).
16+
17+
**Note:** The share consumer is currently in **Preview** and should not be used in production environments. Its public interfaces may change before General Availability, and known limitations apply (see the guide). The share consumer is single-threaded and not thread-safe. It requires a broker with share groups enabled (generally available in Apache Kafka 4.2.0).
18+
19+
### Features
20+
21+
- New optional install `confluent-kafka[oauthbearer-aws]` provides AWS IAM-based
22+
OAUTHBEARER authentication via AWS STS `GetWebIdentityToken`. Activate by setting `sasl.oauthbearer.method=oidc`,
23+
`sasl.oauthbearer.metadata.authentication.type=aws_iam`, and
24+
`sasl.oauthbearer.config="region=...,audience=..."`. See the
25+
[AWS IAM OAUTHBEARER guide](docs/oauthbearer-aws.md) for full configuration, and
26+
[`examples/oauth_oidc_ccloud_aws_iam.py`](examples/oauth_oidc_ccloud_aws_iam.py)
27+
for a worked example.
28+
29+
### Enhancements
30+
31+
- Add support for union-of-pools and auto pool mapping for Schema Registry (#2182)
432

533
### Fixes
634

7-
- Fix Encryption fails when expanded union types have two references to the same record (#2262)
35+
- Fix Encryption fails when expanded union types have two references to the same record (@ChristophMajcenAtXxxlutz, #2262)
36+
- Make orjson optional in JSON serdes with stdlib json fallback (#2281)
37+
- Handle non-http errors during retries (#2292)
38+
- Use TLS certification verification with Hashicorp Vault (#2294)
39+
40+
41+
confluent-kafka-python v2.15.0 is based on librdkafka v2.15.0, see the
42+
[librdkafka release notes](https://github.com/confluentinc/librdkafka/releases/tag/v2.15.0)
43+
for a complete list of changes, enhancements, fixes and upgrade considerations.
44+
45+
846

947
## v2.14.2 - 2026-06-03
1048

README.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Unlike the basic Apache Kafka Python client, `confluent-kafka-python` provides:
2424

2525
- **High Performance & Reliability**: Built on [`librdkafka`](https://github.com/confluentinc/librdkafka), the battle-tested C client for Apache Kafka, ensuring maximum throughput, low latency, and stability. The client is supported by Confluent and is trusted in mission-critical production environments.
2626
- **Comprehensive Kafka Support**: Full support for the Kafka protocol, transactions, and administration APIs.
27+
- **Queues for Kafka (Preview)**: A `ShareConsumer` ([KIP-932](https://cwiki.apache.org/confluence/display/KAFKA/KIP-932%3A+Queues+for+Kafka)) for queue-like, cooperative consumption with per-record acknowledgement. See the [Share Consumer guide](docs/kip-932-share-consumer.md). **Preview** — not recommended for production.
2728
- **AsyncIO Producer**: A fully asynchronous producer (`AIOProducer`) for seamless integration with modern Python applications using `asyncio`.
2829
- **Seamless Schema Registry Integration**: Synchronous and asynchronous clients for Confluent Schema Registry to handle schema management and serialization (Avro, Protobuf, JSON Schema).
2930
- **Improved Error Handling**: Detailed, context-aware error messages and exceptions to speed up debugging and troubleshooting.
@@ -263,7 +264,10 @@ for topic, f in fs.items():
263264
```
264265
## Thread safety
265266

266-
The `Producer`, `Consumer`, and `AdminClient` are all thread safe.
267+
The `Producer`, `Consumer`, and `AdminClient` are all thread safe. The
268+
`ShareConsumer` (Preview) is **not** thread safe — a single instance must not
269+
be used concurrently from multiple threads (see the
270+
[Share Consumer guide](docs/kip-932-share-consumer.md)).
267271
## Install
268272

269273
```bash
@@ -277,6 +281,9 @@ pip install "confluent-kafka[protobuf,schemaregistry]" # Protobuf
277281

278282
# With Data Contract rules (includes CSFLE support)
279283
pip install "confluent-kafka[avro,schemaregistry,rules]"
284+
285+
# With AWS IAM OAUTHBEARER authentication (mints JWTs via AWS STS GetWebIdentityToken)
286+
pip install "confluent-kafka[oauthbearer-aws]"
280287
```
281288

282289
**Note:** Pre-built Linux wheels do not include SASL Kerberos/GSSAPI support. For Kerberos, see the source installation instructions in [INSTALL.md](INSTALL.md).
@@ -304,6 +311,20 @@ When using Data Contract rules (including CSFLE) add the `rules`extra, e.g.:
304311
pip install "confluent-kafka[avro,schemaregistry,rules]"
305312
```
306313

314+
To authenticate to a Kafka cluster using AWS IAM (when running on EC2, EKS, ECS,
315+
Fargate, or Lambda with an IAM role attached), add the `oauthbearer-aws` extra:
316+
317+
```bash
318+
pip install "confluent-kafka[oauthbearer-aws]"
319+
```
320+
321+
Activation is config-only — set `sasl.oauthbearer.method=oidc`,
322+
`sasl.oauthbearer.metadata.authentication.type=aws_iam`, and
323+
`sasl.oauthbearer.config="region=...,audience=..."`. The client mints fresh
324+
JWTs via AWS STS on every token refresh — no static credentials, no Python-side
325+
imports. See [`examples/oauth_oidc_ccloud_aws_iam.py`](examples/oauth_oidc_ccloud_aws_iam.py)
326+
for a worked example.
327+
307328
**Install from source**
308329

309330
For source install, see the *Install from source* section in [INSTALL.md](INSTALL.md).

docs/Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ rst2md:
5555
$(PANDOC) --wrap=none --from=rst --to=gfm --output=kip-848-migration-guide.md kip-848-migration-guide.rst
5656
@echo
5757
@echo "KIP-848 Migration Guide Markdown file generated: kip-848-migration-guide.md"
58+
$(PANDOC) --wrap=none --from=rst --to=gfm --output=kip-932-share-consumer.md kip-932-share-consumer.rst
59+
@echo
60+
@echo "KIP-932 Share Consumer guide Markdown file generated: kip-932-share-consumer.md"
61+
$(PANDOC) --wrap=none --from=rst --to=gfm --output=oauthbearer-aws.md oauthbearer-aws.rst
62+
@echo
63+
@echo "AWS IAM OAUTHBEARER guide Markdown file generated: oauthbearer-aws.md"
5864

5965
html:
6066
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html

docs/index.rst

Lines changed: 82 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@ Guides
77
- :ref:`Configuration Guide <pythonclient_configuration>`
88
- :ref:`Transactional API <pythonclient_transactional>`
99
- :ref:`KIP-848 Migration Guide <pythonclient_migration_kip848>`
10+
- :ref:`KIP-932 Share Consumer (Queues for Kafka) <pythonclient_kip932_share_consumer>`
11+
- :ref:`AWS IAM OAUTHBEARER <pythonclient_oauthbearer_aws>`
1012

1113
Client API
1214
- :ref:`Producer <pythonclient_producer>`
1315
- :ref:`Consumer <pythonclient_consumer>`
16+
- :ref:`ShareConsumer <pythonclient_shareconsumer>`
1417
- :ref:`AdminClient <pythonclient_adminclient>`
1518
- :ref:`SchemaRegistryClient <schemaregistry_client>`
1619

@@ -34,6 +37,8 @@ Supporting classes
3437
- :ref:`ConsumerGroupState <pythonclient_consumer_group_state>`
3538
- :ref:`Uuid <pythonclient_uuid>`
3639
- :ref:`ElectionType <pythonclient_election_type>`
40+
- :ref:`Messages <pythonclient_messages>`
41+
- :ref:`AcknowledgeType <pythonclient_acknowledge_type>`
3742

3843
- Errors:
3944
- :ref:`KafkaError <pythonclient_kafkaerror>`
@@ -45,6 +50,8 @@ Supporting classes
4550
- :ref:`ValueSerializationError <serde_error_serializer_value>`
4651
- :ref:`KeyDeserializationError <serde_error_deserializer_key>`
4752
- :ref:`ValueDeserializationError <serde_error_deserializer_value>`
53+
- :ref:`IllegalStateException <pythonclient_illegalstateexception>`
54+
- :ref:`ConcurrentModificationException <pythonclient_concurrentmodificationexception>`
4855

4956
- Admin API
5057
- :ref:`NewTopic <pyclient_admin_newtopic>`
@@ -89,6 +96,7 @@ Experimental
8996

9097
- :ref:`SerializingProducer <serde_producer>`
9198
- :ref:`DeserializingConsumer <serde_consumer>`
99+
- :ref:`DeserializingShareConsumer <serde_share_consumer>`
92100

93101
Legacy
94102
These classes are deprecated and will be removed in a future version of the library.
@@ -427,6 +435,16 @@ Consumer
427435
:members:
428436
:noindex:
429437

438+
.. _pythonclient_shareconsumer:
439+
440+
*************
441+
ShareConsumer
442+
*************
443+
444+
.. autoclass:: confluent_kafka.ShareConsumer
445+
:members:
446+
:noindex:
447+
430448
.. _serde_consumer:
431449

432450
************************************
@@ -438,6 +456,17 @@ DeserializingConsumer (experimental)
438456

439457
:inherited-members:
440458

459+
.. _serde_share_consumer:
460+
461+
*****************************************
462+
DeserializingShareConsumer (experimental)
463+
*****************************************
464+
465+
.. autoclass:: confluent_kafka.DeserializingShareConsumer
466+
:members:
467+
468+
:inherited-members:
469+
441470
.. _pythonclient_producer:
442471

443472
********
@@ -640,6 +669,24 @@ Message
640669
.. autoclass:: confluent_kafka.Message
641670
:members:
642671

672+
.. _pythonclient_messages:
673+
674+
********
675+
Messages
676+
********
677+
678+
.. autoclass:: confluent_kafka.Messages
679+
:members:
680+
681+
.. _pythonclient_acknowledge_type:
682+
683+
***************
684+
AcknowledgeType
685+
***************
686+
687+
.. autoclass:: confluent_kafka.AcknowledgeType
688+
:members:
689+
643690
.. _pythonclient_topicpartition:
644691

645692
**************
@@ -775,6 +822,24 @@ KafkaException
775822
.. autoclass:: confluent_kafka.KafkaException
776823
:members:
777824

825+
.. _pythonclient_illegalstateexception:
826+
827+
**********************
828+
IllegalStateException
829+
**********************
830+
831+
.. autoclass:: confluent_kafka.IllegalStateException
832+
:members:
833+
834+
.. _pythonclient_concurrentmodificationexception:
835+
836+
********************************
837+
ConcurrentModificationException
838+
********************************
839+
840+
.. autoclass:: confluent_kafka.ConcurrentModificationException
841+
:members:
842+
778843
.. _pyclient_error_consumer:
779844

780845
************
@@ -1098,4 +1163,20 @@ https://github.com/edenhill/librdkafka/blob/master/CONFIGURATION.md
10981163
`KIP-848 <https://cwiki.apache.org/confluence/display/KAFKA/KIP-848%3A+The+Next+Generation+of+the+Consumer+Rebalance+Protocol>`_ - Migration Guide
10991164
==================================================================================================================================================
11001165

1101-
.. include:: kip-848-migration-guide.rst
1166+
.. include:: kip-848-migration-guide.rst
1167+
1168+
1169+
.. _pythonclient_kip932_share_consumer:
1170+
1171+
`KIP-932 <https://cwiki.apache.org/confluence/display/KAFKA/KIP-932%3A+Queues+for+Kafka>`_ - Share Consumer (Queues for Kafka)
1172+
===============================================================================================================================
1173+
1174+
.. include:: kip-932-share-consumer.rst
1175+
1176+
1177+
.. _pythonclient_oauthbearer_aws:
1178+
1179+
AWS IAM OAUTHBEARER Authentication
1180+
==================================
1181+
1182+
.. include:: oauthbearer-aws.rst

0 commit comments

Comments
 (0)