Gatling version: 3.11.2 (must be up to date)
Gatling flavor: java
Gatling build tool: maven
I am experiencing a issue with Gatling when I am using requestReply(). The load test hangs . Here is the code snippet that I am using
public class PaymentRequestJmsSimulation extends Simulation {
Logger log = LoggerFactory.getLogger(PaymentRequestJmsSimulation.class);
ConnectionFactory connectionFactory =
new org.apache.activemq.ActiveMQConnectionFactory("tcp://localhost:61616");
String correlationId = UUID.randomUUID().toString();
JmsProtocolBuilder jmsProtocol =
jms.connectionFactory(connectionFactory)
.credentials("admin", "secret")
.replyTimeout(30000)
.usePersistentDeliveryMode();
ScenarioBuilder scn =
scenario("JMS DSL test")
.repeat(1)
.on(
exec(
jms("Pain013 Message")
.requestReply()
.queue("rtp.pain013.in")
.replyQueue("rtp.pain013.acks")
.textMessage(Pain013MessageFixture.PAIN_013_MESSAGE)
.property("jms_correlationId", correlationId)
.check(simpleCheck(this::checkBodyTextCorrect))));
// with pain013
// xml message
{
setUp(scn.injectOpen(rampUsers(1).during(5))).protocols(jmsProtocol);
}
public boolean checkBodyTextCorrect(Message m) {
// this assumes that the service just does an "uppercase" transform on the text
if (m instanceof TextMessage) {
try {
return m.getJMSCorrelationID().equals(correlationId);
} catch (JMSException e) {
throw new RuntimeException(e);
}
} else {
return false;
}
}
}
On the JMS Listener side the code looks like
public void onMessage(
Message cparMessage,
@Header(JmsHeaders.CORRELATION_ID) String idempotencyKey,
Session session)
throws JMSException {
jmsTemplate.send("rtp.pain013.acks", session1 -> {
log.info("Message sent to rtp.pain013.acks with correlation id {}", idempotencyKey);
TextMessage message = session1.createTextMessage();
message.setJMSCorrelationID(idempotencyKey);
return message;
});
}
The output looks like
---- JMS DSL test --------------------------------------------------------------
[--------------------------------------------------------------------------] 0%
waiting: 0 / active: 1 / done: 0
================================================================================
JMS Listener receives the message but it seems like Gatling is not able to check the reply queue and that’s why it hangs.