Project Setup
Learn how to set up your project to use the Gatling Kafka protocol.
Understand the license and limitations
The Gatling Kafka component is distributed under the Gatling Enterprise Component License.
The Gatling Kafka protocol can be used with both the Community Edition and Enterprise versions of Gatling.
Its usage is unlimited when running tests on Gatling Enterprise. When used with Gatling Community Edition, usage is limited to:
- 5 users maximum
- 5 minute duration tests
Limits after which the test will stop. This means that all locally executed tests using the Kafka protocol are limited by these values. When the test stops, Gatling logs which limit it exceeded.
Get started with the demo project
A demo project is available for each supported language and build tool:
Add the Gatling Kafka dependency
The Gatling Kafka plugin isn’t included with Gatling by default. Add the Gatling Kafka dependency, in addition to the usual Gatling dependencies.
The Gatling Kafka plugin requires Gatling 3.16.1 or later, and is available for Java, Kotlin, and Scala. It isn’t available for JavaScript and TypeScript.
For Java or Kotlin:
<dependencies>
<dependency>
<groupId>io.gatling</groupId>
<artifactId>gatling-kafka-java</artifactId>
<version>3.16.1.1</version>
<scope>test</scope>
</dependency>
</dependencies>
Base Gatling setup for Maven is documented here.
dependencies {
gatlingImplementation("io.gatling:gatling-kafka-java:3.16.1.1")
}
Base Gatling setup for Gradle is documented here.
For Scala:
<dependencies>
<dependency>
<groupId>io.gatling</groupId>
<artifactId>gatling-kafka</artifactId>
<version>3.16.1.1</version>
<scope>test</scope>
</dependency>
</dependencies>
Base Gatling setup for Maven is documented here.
dependencies {
gatlingImplementation("io.gatling:gatling-kafka:3.16.1.1")
}
Base Gatling setup for Gradle is documented here.
libraryDependencies += "io.gatling" % "gatling-kafka" % "3.16.1.1" % "test,it"
Base Gatling setup for sbt is documented here.
The plugin brings the Apache Kafka client, org.apache.kafka:kafka-clients.
Add the optional libraries
Some features need a library that the plugin doesn’t bring. Add it in the same scope as the Gatling dependencies when you use the feature:
| Feature | Library |
|---|---|
| Avro, Protobuf, and JSON Schema | Confluent’s serializer of the format, such as io.confluent:kafka-avro-serializer, from Confluent’s repository |
| Amazon MSK IAM authentication | software.amazon.msk:aws-msk-iam-auth |
Gatling fails at startup, naming the missing library, when a simulation uses one of these features without it.