-
Notifications
You must be signed in to change notification settings - Fork 25
/
ProducerSimulation.kt
30 lines (24 loc) · 1.06 KB
/
ProducerSimulation.kt
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
package ru.tinkoff.gatling.kafka.javaapi.examples
import io.gatling.javaapi.core.CoreDsl.*
import io.gatling.javaapi.core.Simulation
import org.apache.kafka.clients.producer.ProducerConfig
import ru.tinkoff.gatling.kafka.javaapi.KafkaDsl.*
import java.time.Duration
class ProducerSimulation : Simulation() {
private val kafkaConsumerConf = kafka().topic("test.topic")
.properties(mapOf<String, Any>(ProducerConfig.ACKS_CONFIG to "1",
ProducerConfig.BOOTSTRAP_SERVERS_CONFIG to "localhost:9092",
ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG to "org.apache.kafka.common.serialization.StringSerializer",
ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG to "org.apache.kafka.common.serialization.StringSerializer"
))
private val scn = scenario("Basic")
.exec(kafka("BasicRequest").send("foo"))
.exec(kafka("dld").send("true", "12.0"))
init {
setUp(
scn.injectOpen(atOnceUsers(1))
)
.protocols(kafkaConsumerConf)
.maxDuration(Duration.ofSeconds(120))
}
}