Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,6 @@ dmypy.json
.pyre/

.idea
.gradle
bin
obj
15 changes: 8 additions & 7 deletions MAINTAINERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@

## Maintainers

| Maintainer | Email | GitHub ID | Affiliation | Joined |
|----------------------|------------------------------------------|-------------------------------------------------------------| ------------------------------------------------------------------------------------------------- |------------|
| Jörn Schimmelpfeng | <[email protected]> | [JoernSchimmelpfeng](https://github.com/joernschimmelpfeng) | Mercedes-Benz Connectivity Services GmbH, [imprint](https://connectivity.mercedes-benz.com/imprint) | 04/01/2021 |
| Javier Moreno Molina | <[email protected]> | [morelina](https://github.com/morelina) | Mercedes-Benz Connectivity Services GmbH, [imprint]( https://connectivity.mercedes-benz.com/imprint) | 04/01/2021 |
| David Piendl | <[email protected]> | [davidpiendl](https://github.com/davidpiendl) | Mercedes-Benz Connectivity Services GmbH, [imprint]( https://connectivity.mercedes-benz.com/imprint) | 07/05/2022 |
| Alexander Schapelt | <[email protected]> | [SCHAPEA] | Mercedes-Benz Connectivity Services GmbH, [imprint]( https://connectivity.mercedes-benz.com/imprint) | 07/05/2022 |
| Akhilesh Sreelayam | <[email protected]> | [AkhileshSreelayam](https://github.com/akhileshsreelayam) | Mercedes-Benz Connectivity Services GmbH, [imprint]( https://connectivity.mercedes-benz.com/imprint) | 19/06/2024 |
| Maintainer | Email | GitHub ID | Affiliation | Joined |
|-----------------------|------------------------------------------|-------------------------------------------------------------| ---------------------------------------------------------------------------------------------------- |------------|
| Jörn Schimmelpfeng | <[email protected]> | [JoernSchimmelpfeng](https://github.com/joernschimmelpfeng) | Mercedes-Benz Connectivity Services GmbH, [imprint](https://connectivity.mercedes-benz.com/imprint) | 04/01/2021 |
| Javier Moreno Molina | <[email protected]> | [morelina](https://github.com/morelina) | Mercedes-Benz Connectivity Services GmbH, [imprint]( https://connectivity.mercedes-benz.com/imprint) | 04/01/2021 |
| David Piendl | <[email protected]> | [davidpiendl](https://github.com/davidpiendl) | Mercedes-Benz Connectivity Services GmbH, [imprint]( https://connectivity.mercedes-benz.com/imprint) | 07/05/2022 |
| Alexander Schapelt | <[email protected]> | [SCHAPEA] | Mercedes-Benz Connectivity Services GmbH, [imprint]( https://connectivity.mercedes-benz.com/imprint) | 07/05/2022 |
| Akhilesh Sreelayam | <[email protected]> | [AkhileshSreelayam](https://github.com/akhileshsreelayam) | Mercedes-Benz Connectivity Services GmbH, [imprint]( https://connectivity.mercedes-benz.com/imprint) | 19/06/2024 |
| Alexis Sarda-Espinosa | <[email protected]> | [asardaes](https://github.com/asardaes) | Mercedes-Benz Connectivity Services GmbH, [imprint]( https://connectivity.mercedes-benz.com/imprint) | 17/09/2025 |

<!--
## Emeritus Maintainers
Expand Down
15 changes: 5 additions & 10 deletions kafka-sample/c#/KafkaOauthDemo.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright 2021 Mercedes-Benz Connectivity Services GmbH
// Copyright 2021-2025 Mercedes-Benz Connectivity Services GmbH
//
// SPDX-License-Identifier: MIT

Expand All @@ -22,19 +22,14 @@ static void Main()
var bootstrapUrl = "BOOTSTRAP_URL"; // use the correct broker url for your region
var oauthTokenApiUrl = "OAUTH_TOKEN_API_URL"; // use the correct token API url for your region

var securityProtocol = SecurityProtocol.SaslSsl;
var saslMechanism = SaslMechanism.OAuthBearer;
var sslEndpointIdentificationAlgorithm = SslEndpointIdentificationAlgorithm.None;
var autoOffsetReset = AutoOffsetReset.Earliest;

var config = new ConsumerConfig
{
BootstrapServers = bootstrapUrl,
GroupId = consumerGroup,

SslEndpointIdentificationAlgorithm = sslEndpointIdentificationAlgorithm,
SecurityProtocol = securityProtocol,
SaslMechanism = saslMechanism,
SslEndpointIdentificationAlgorithm = SslEndpointIdentificationAlgorithm.None,
SecurityProtocol = SecurityProtocol.SaslSsl,
SaslMechanism = SaslMechanism.OAuthBearer,

SaslOauthbearerMethod = SaslOauthbearerMethod.Oidc,
SaslOauthbearerClientId = clientId,
Expand All @@ -43,7 +38,7 @@ static void Main()
SaslOauthbearerTokenEndpointUrl = oauthTokenApiUrl,

Debug = "consumer,security",
AutoOffsetReset = autoOffsetReset,
AutoOffsetReset = AutoOffsetReset.Latest,
};


Expand Down
2 changes: 1 addition & 1 deletion kafka-sample/c#/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This is only a sample without support and liability to its correctness!
Prerequisite
------------

The code is based on .Net 8.0 and the Confluent.Kafka client (2.1.1).
The code is based on .Net 8.0 and the Confluent.Kafka client (2.11.1).

Package Links:

Expand Down
2 changes: 1 addition & 1 deletion kafka-sample/c#/c#.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Confluent.Kafka" Version="2.1.1" />
<PackageReference Include="Confluent.Kafka" Version="2.11.1" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion kafka-sample/golang/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This is only a sample without support and liability to its correctness!
Prerequisite
------------

The code is based on Go 1.20 and the confluent-kafka-go v2.1.1.
The code is based on Go 1.25 and the confluent-kafka-go v2.11.1.

Links:

Expand Down
8 changes: 4 additions & 4 deletions kafka-sample/golang/go.mod
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
//
// Copyright 2022 Mercedes-Benz Connectivity Services GmbH
// Copyright 2022-2025 Mercedes-Benz Connectivity Services GmbH
//
// SPDX-License-Identifier: MIT

module golang

go 1.20
go 1.25

require (
github.com/confluentinc/confluent-kafka-go/v2 v2.1.1
github.com/confluentinc/confluent-kafka-go/v2 v2.11.1
github.com/sirupsen/logrus v1.9.3
)

require golang.org/x/sys v0.9.0 // indirect
require golang.org/x/sys v0.36.0 // indirect
4 changes: 4 additions & 0 deletions kafka-sample/golang/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,8 @@ github.com/cockroachdb/errors v1.2.4/go.mod h1:rQD95gz6FARkaKkQXUksEje/d9a6wBJoC
github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f/go.mod h1:i/u985jwjWRlyHXQbwatDASoW0RMlZ/3i9yJHE2xLkI=
github.com/confluentinc/confluent-kafka-go/v2 v2.1.1 h1:qwZtgyGS4OjvebR4TkZPxHAQRN/IbdaxpCQyhDpxeaE=
github.com/confluentinc/confluent-kafka-go/v2 v2.1.1/go.mod h1:mfGzHbxQ6LRc25qqaLotDHkhdYmeZQ3ctcKNlPUjDW4=
github.com/confluentinc/confluent-kafka-go/v2 v2.11.1 h1:qGCQznyp2BxyBNyOE+M7O1YS2tI1/Y60O0jQP452zA4=
github.com/confluentinc/confluent-kafka-go/v2 v2.11.1/go.mod h1:hScqtFIGUI1wqHIgM3mjoqEou4VweGGGX7dMpcUKves=
github.com/containerd/aufs v0.0.0-20200908144142-dab0cbea06f4/go.mod h1:nukgQABAEopAHvB6j7cnP5zJ+/3aVcE7hCYqvIwAHyE=
github.com/containerd/aufs v0.0.0-20201003224125-76a6863f2989/go.mod h1:AkGGQs9NM2vtYHaUen+NljV0/baGCAPELGm2q9ZXpWU=
github.com/containerd/aufs v0.0.0-20210316121734-20793ff83c97/go.mod h1:kL5kd6KM5TzQjR79jljyi4olc1Vrx6XBlcyj3gNv2PU=
Expand Down Expand Up @@ -1916,6 +1918,8 @@ golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s=
golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k=
golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
Expand Down
2 changes: 1 addition & 1 deletion kafka-sample/golang/kafka-oauth-consumer.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright 2022 Mercedes-Benz Connectivity Services GmbH
// Copyright 2022-2025 Mercedes-Benz Connectivity Services GmbH
//
// SPDX-License-Identifier: MIT

Expand Down
29 changes: 16 additions & 13 deletions kafka-sample/java/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ This is only a sample without support and liability to its correctness!
Prerequisite
------------

The code is based on java version 17 and gradle. Required dependencies:
The code is based on java version 21 and gradle. Required dependencies:

* [com.github.johnrengelman.shadow](https://github.com/johnrengelman/shadow)
* [gradle shadow plugin](https://github.com/GradleUp/shadow)
* [apache kafka-clients](https://kafka.apache.org/documentation/)
* [jose4j](https://bitbucket.org/b_c/jose4j/wiki/Home) (see also [KIP-1139](https://cwiki.apache.org/confluence/display/KAFKA/KIP-1139%3A+Add+support+for+OAuth+jwt-bearer+grant+type))
* [jackson-databind](https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind) (runtimeOnly)
* [log4j2](https://logging.apache.org/log4j/2.x/)
* [apache commons-cli](https://commons.apache.org/proper/commons-cli/index.html)
Expand All @@ -34,23 +35,25 @@ How to use
To use the sample please change at least the following configurations of the [consumer.properties file](consumer.properties).

```properties
# if you are an MBCon customer, use the clientId and clientSecret you have received along with the correct scope for your region:
sasl.jaas.config=org.apache.kafka.common.security.oauthbearer.OAuthBearerLoginModule required \
clientId="YOUR_CLIENT_ID" \
clientSecret="YOUR_CLIENT_SECRET" \
scope="SCOPE";
# use the correct token API url for your region:
sasl.oauthbearer.token.endpoint.url=OAUTH_TOKEN_API_URL
# if you are an MBCon customer, use the received client name as the prefix. eg: '<client name>.GROUP_ID_POSTFIX_OF_YOUR_CHOICE':
group.id=CONSUMER_GROUP
# use the correct bootstrap url for your region
bootstrap.servers=BOOTSTRAP_URL
# if you are an MBCon customer, use the received client name as the prefix. eg: '<client name>.GROUP_ID_POSTFIX_OF_YOUR_CHOICE':
group.id=CONSUMER_GROUP
# use the correct token API url for your region:
sasl.oauthbearer.token.endpoint.url=OAUTH_TOKEN_API_URL

# if you are an MBCon customer, use the clientId and clientSecret you have received along with the correct scope for your region:
sasl.oauthbearer.client.credentials.client.id=YOUR_CLIENT_ID
sasl.oauthbearer.client.credentials.client.secret=YOUR_CLIENT_SECRET
sasl.oauthbearer.scope=SCOPE
```

After preparation, you can start the demo with

```bash
java -jar build/libs/java-0.1.0-all.jar -t <YOUR_TOPIC_NAME>
java '-Dorg.apache.kafka.sasl.oauthbearer.allowed.urls=<OAUTH_TOKEN_API_URL>' -jar build/libs/java-0.1.0-all.jar -t <YOUR_TOPIC_NAME>
```

Copyright 2024 Mercedes-Benz Connectivity Services GmbH
And note that, for the Kafka client version 4 and newer, the token URL must be explicitly repeated in the shown property.

Copyright 2024-2025 Mercedes-Benz Connectivity Services GmbH
11 changes: 6 additions & 5 deletions kafka-sample/java/build.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
plugins {
id 'java'
id 'application'
id 'com.github.johnrengelman.shadow' version "$shadow_plugin_version"
id 'com.gradleup.shadow' version "$shadow_plugin_version"
}

group = 'com.mbcs'
version = '0.1.0'

java {
toolchain {
languageVersion = JavaLanguageVersion.of(java_version)
}
tasks.withType(JavaCompile).configureEach {
options.encoding = "UTF-8"
options.deprecation = true
options.release.set(java_version.toInteger())
}

repositories {
Expand All @@ -24,6 +24,7 @@ application {
dependencies {
// dependencies for kafka:
implementation "org.apache.kafka:kafka-clients:$kafka_clients_version"
implementation "org.bitbucket.b_c:jose4j:$jose4j_version"
runtimeOnly "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version" // needed for OAUTHBEARER

// dependencies to enable logging with log4j2:
Expand Down
22 changes: 11 additions & 11 deletions kafka-sample/java/consumer.properties
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# if you are an MBCon customer, use the clientId and clientSecret you have received along with the correct scope for your region:
sasl.jaas.config=org.apache.kafka.common.security.oauthbearer.OAuthBearerLoginModule required \
clientId="YOUR_CLIENT_ID" \
clientSecret="YOUR_CLIENT_SECRET" \
scope="SCOPE";
# use the correct token API url for your region:
sasl.oauthbearer.token.endpoint.url=OAUTH_TOKEN_API_URL
# if you are an MBCon customer, use the received client name as the prefix. eg: '<client name>.GROUP_ID_POSTFIX_OF_YOUR_CHOICE':
group.id=CONSUMER_GROUP
# use the correct bootstrap url for your region
bootstrap.servers=BOOTSTRAP_URL
sasl.login.callback.handler.class=org.apache.kafka.common.security.oauthbearer.secured.OAuthBearerLoginCallbackHandler
# if you are an MBCon customer, use the received client name as the prefix. eg: '<client name>.GROUP_ID_POSTFIX_OF_YOUR_CHOICE':
group.id=CONSUMER_GROUP
# use the correct token API url for your region:
sasl.oauthbearer.token.endpoint.url=OAUTH_TOKEN_API_URL
sasl.login.callback.handler.class=org.apache.kafka.common.security.oauthbearer.OAuthBearerLoginCallbackHandler
sasl.mechanism=OAUTHBEARER
security.protocol=SASL_SSL
# following setting can be adjusted to your preferences:
auto.offset.reset=latest
enable.auto.commit=true
key.deserializer=org.apache.kafka.common.serialization.StringDeserializer
value.deserializer=org.apache.kafka.common.serialization.StringDeserializer
value.deserializer=org.apache.kafka.common.serialization.StringDeserializer
# if you are an MBCon customer, use the clientId and clientSecret you have received along with the correct scope for your region:
sasl.jaas.config=org.apache.kafka.common.security.oauthbearer.OAuthBearerLoginModule required;
sasl.oauthbearer.client.credentials.client.id=YOUR_CLIENT_ID
sasl.oauthbearer.client.credentials.client.secret=YOUR_CLIENT_SECRET
sasl.oauthbearer.scope=SCOPE
13 changes: 7 additions & 6 deletions kafka-sample/java/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
shadow_plugin_version=8.1.1
java_version=17
kafka_clients_version=3.5.0
jackson_databind_version=2.15.2
log4j2_version=2.20.0
commons_cli_version=1.5.0
java_version=21
shadow_plugin_version=9.1.0
kafka_clients_version=4.1.0
jose4j_version=0.9.6
jackson_databind_version=2.20.0
log4j2_version=2.25.1
commons_cli_version=1.10.0

Binary file modified kafka-sample/java/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 3 additions & 2 deletions kafka-sample/java/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#Fri Jun 30 12:42:27 CEST 2023
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
49 changes: 33 additions & 16 deletions kafka-sample/java/gradlew
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

#
# Copyright © 2015-2021 the original authors.
# Copyright © 2015 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand All @@ -80,13 +82,11 @@ do
esac
done

APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -114,7 +114,7 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;;
esac

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
CLASSPATH="\\\"\\\""


# Determine the Java command to use to start the JVM.
Expand All @@ -133,22 +133,29 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi

# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -193,18 +200,28 @@ if "$cygwin" || "$msys" ; then
done
fi

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"

# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi

# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
Expand Down
Loading