-
Notifications
You must be signed in to change notification settings - Fork 19
/
PublishExample.java
49 lines (41 loc) · 1.61 KB
/
PublishExample.java
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
44
45
46
47
48
49
package ru.tinkoff.gatling.amqp.javaapi.examples;
import io.gatling.javaapi.core.ScenarioBuilder;
import io.gatling.javaapi.core.Simulation;
import ru.tinkoff.gatling.amqp.javaapi.protocol.AmqpProtocolBuilder;
import ru.tinkoff.gatling.amqp.javaapi.protocol.AmqpQueue;
import java.util.Map;
import static io.gatling.javaapi.core.CoreDsl.*;
import static ru.tinkoff.gatling.amqp.javaapi.AmqpDsl.*;
public class PublishExample extends Simulation {
public AmqpProtocolBuilder amqpConf = amqp()
.connectionFactory(
rabbitmq()
.host("localhost")
.port(5672)
.username("guest")
.password("guest")
.vhost("/")
.build()
)
.usePersistentDeliveryMode()
.declare(new AmqpQueue("test_q_in", false, false, false, Map.of()));
public ScenarioBuilder scn = scenario("AMQP test")
.feed(Utils.idFeeder)
.exec(
amqp("publish to exchange")
.publish()
.queueExchange("test_q_in")
.textMessage("Hello message - #{id}")
.messageId("#{id}")
.priority(0)
);
{
setUp(
scn.injectOpen(
rampUsersPerSec(1).to(5).during(60),
constantUsersPerSec(5).during(300))
)
.protocols(amqpConf)
.maxDuration(600);
}
}