-
Notifications
You must be signed in to change notification settings - Fork 19
/
PublishExample.scala
40 lines (33 loc) · 1.03 KB
/
PublishExample.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
package ru.tinkoff.gatling.amqp.examples
import io.gatling.core.Predef._
import io.gatling.core.structure.ScenarioBuilder
import ru.tinkoff.gatling.amqp.Predef._
import ru.tinkoff.gatling.amqp.examples.Utils._
import ru.tinkoff.gatling.amqp.protocol.AmqpProtocolBuilder
import scala.concurrent.duration._
class PublishExample extends Simulation {
val amqpConf: AmqpProtocolBuilder = amqp
.connectionFactory(
rabbitmq
.host("localhost")
.port(5672)
.username("guest")
.password("guest")
.vhost("/"),
)
.usePersistentDeliveryMode
.declare(queue("test_q_in"))
val scn: ScenarioBuilder = scenario("AMQP test")
.feed(idFeeder)
.exec(
amqp("publish to exchange").publish
.queueExchange("test_q_in")
.textMessage("Hello message - #{id}")
.messageId("#{id}")
.priority(0),
)
setUp(
scn.inject(rampUsersPerSec(1) to 5 during (60 seconds), constantUsersPerSec(5) during (5 minutes)),
).protocols(amqpConf)
.maxDuration(10 minutes)
}