-
Notifications
You must be signed in to change notification settings - Fork 20
/
PublishExample.kt
42 lines (38 loc) · 1.26 KB
/
PublishExample.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
31
32
33
34
35
36
37
38
39
40
41
42
package ru.tinkoff.gatling.amqp.javaapi.examples
import io.gatling.javaapi.core.CoreDsl.*
import io.gatling.javaapi.core.*
import ru.tinkoff.gatling.amqp.javaapi.AmqpDsl.*
import ru.tinkoff.gatling.amqp.javaapi.protocol.AmqpProtocolBuilder
class PublishExample : Simulation() {
val amqpConf: AmqpProtocolBuilder = amqp()
.connectionFactory(
rabbitmq()
.host("localhost")
.port(5672)
.username("guest")
.password("guest")
.vhost("/")
.build()
)
.usePersistentDeliveryMode()
.declare(AmqpQueue("test_q_in", false, false, false, mapOf<String, Any>()))
val scn: ScenarioBuilder = scenario("AMQP test")
.feed(Utils.idFeeder)
.exec(
amqp("publish to exchange")
.publish()
.queueExchange("test_q_in")
.textMessage("Hello message - #{id}")
.messageId("#{id}")
.priority(0),
);
init {
setUp(
scn.injectOpen(
rampUsersPerSec(1.0).to(5.0).during(60),
constantUsersPerSec(5.0).during(5 * 60)
),
).protocols(amqpConf)
.maxDuration(10 * 60)
}
}