-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathKafkaJavaapiMethodsGatlingTest.scala
43 lines (38 loc) · 1.31 KB
/
KafkaJavaapiMethodsGatlingTest.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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),
)
}