-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: kafka message with payload and headers and without key (#159)
* feat: kafka simple send without key and with headers for scala and javaapi * feat: enable test in CI * feat: add test in scala * fix: scalafmt * fix: links on examples --------- Co-authored-by: a.ugodnikov <[email protected]>
- Loading branch information
Showing
6 changed files
with
69 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
43 changes: 43 additions & 0 deletions
43
src/test/scala/ru/tinkoff/gatling/kafka/examples/KafkaJavaapiMethodsGatlingTest.scala
This file contains 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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package ru.tinkoff.gatling.kafka.examples | ||
|
||
import io.gatling.core.Predef._ | ||
import io.gatling.core.structure.ScenarioBuilder | ||
import org.apache.kafka.clients.producer.ProducerConfig | ||
import org.apache.kafka.common.header.internals.RecordHeaders | ||
import ru.tinkoff.gatling.kafka.javaapi.KafkaDsl._ | ||
|
||
class KafkaJavaapiMethodsGatlingTest extends Simulation { | ||
|
||
val kafkaConfwoKey = kafka | ||
.topic("myTopic3") | ||
.properties( | ||
java.util.Map.of( | ||
ProducerConfig.ACKS_CONFIG, | ||
"1", | ||
ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, | ||
"localhost:9093", | ||
ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, | ||
"org.apache.kafka.common.serialization.StringSerializer", | ||
ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, | ||
"org.apache.kafka.common.serialization.StringSerializer", | ||
), | ||
) | ||
.protocol() | ||
|
||
setUp( | ||
scenario("Request String without key") | ||
.exec( | ||
kafka("Request String without headers and key") | ||
.send("testJavaWithoutKeyAndHeaders") | ||
.asScala(), | ||
) | ||
.exec( | ||
kafka("Request String with headers without key") | ||
.send("testJavaWithHeadersWithoutKey", new RecordHeaders().add("test-header", "test_value".getBytes())) | ||
.asScala(), | ||
) | ||
.inject(nothingFor(1), atOnceUsers(1)) | ||
.protocols(kafkaConfwoKey), | ||
) | ||
|
||
} |