运行 http 测试直到 AMQ 消息被消耗
Run http tests until AMQ msgs consumed
我们运行Gatling/Scala按以下方式对应用程序进行负载测试:
- Post 给 AMQ 的大量消息。
- 运行 消费消息时的一些 REST 调用。
Gatling 设置如下所示:
setUp(
JmsScenario.run inject(atOnceUsers(events)) protocols(JmsScenario.jmsConnect),
HttpScenario.run inject(constantUsersPerSec(httpThroughput) during(httpDuration)) protocols(HttpScenario.protocol),
)
但我不想使用 during(...)
,而是想使用 untilAmqMessageQueueIsEmpty()
之类的东西。有一些(相当简单的)方法可以做到这一点吗?
使用 asLongAs
并调用一些自定义代码(如果您不了解 Scala,则在 Java 中)。
参见 https://gatling.io/docs/current/general/scenario/#aslongas。
// isAmqMessageQueueIsEmpty is something only you can code
// It has to return a Boolean
asLongAs(session => isAmqMessageQueueIsEmpty()) {
???
}
我们运行Gatling/Scala按以下方式对应用程序进行负载测试:
- Post 给 AMQ 的大量消息。
- 运行 消费消息时的一些 REST 调用。
Gatling 设置如下所示:
setUp(
JmsScenario.run inject(atOnceUsers(events)) protocols(JmsScenario.jmsConnect),
HttpScenario.run inject(constantUsersPerSec(httpThroughput) during(httpDuration)) protocols(HttpScenario.protocol),
)
但我不想使用 during(...)
,而是想使用 untilAmqMessageQueueIsEmpty()
之类的东西。有一些(相当简单的)方法可以做到这一点吗?
使用 asLongAs
并调用一些自定义代码(如果您不了解 Scala,则在 Java 中)。
参见 https://gatling.io/docs/current/general/scenario/#aslongas。
// isAmqMessageQueueIsEmpty is something only you can code
// It has to return a Boolean
asLongAs(session => isAmqMessageQueueIsEmpty()) {
???
}