Feeder on JMS objectMessage

Hello everyone,

I would like to ask what is the recommended approach/use of feeder in combination with JMS scenarios. More specifically since we would like to use objectMessages, we need to dynamically create those Messages based on some attributes that we have read from a feeder.

I have only found examples of using feeders with EL and String interpolation, but how can we use feeder with Scala Code :slight_smile: (Newbie question)

An Example:

val scn = scenario(“Generate Responses”).feed(feeder).
exec(jms(“req reply testing”).reqreply
.destination(topic(destinationTopic))
.replyDestination(topic(replyDestinationTopic))
.objectMessage(createObjectMessage("${transaction_id}", “${user_id}”))
.property(“JMSType”, jmsType)

.check(checkMessageCorrect))

def createObjectMessage(transactionId:String, userId:String): Expression[Serializable] = {
...
}

In this example feeder get’s populated successfully, but the interpolation won’t happen.

What’s the recommended approach for scenarios like this.

Thanks,
Konstantinos

If I use an exec() function to generate the actual Object Message like below:

val scn = scenario(“Generate Dealer Responses”).feed(feeder)
.exec(session => {
session.set(“objectMessage”,
createObjectMessage(session(“transaction_id”).as[String], session(“user_id”).as[String]))
})
.exec(jms(“req reply testing”).reqreply
.destination(topic(destinationTopic))
.replyDestination(topic(replyDestinationTopic))
.objectMessage("${objectMessage}")
.property(“VERSION”, “1.1”)
.property(“SENDER_ID”, “Performance-Tester”)
.property(“SYSTEM_ID”, “Performance-Testing-System”)
.property(“JMSType”, jmsType)
.check(checkMessageCorrect))

Then the objectMessage get’s created successfully, but the actual message sent over is wrapped into an Expression, which of course results into an exception on the JMS broker side:

Caused by: javax.jms.JMSException: Failed to build body from content. Serializable class not available to broker. Reason: java.lang.ClassNotFoundException: io.gatling.core.session.package$ExpressionWrapper$$anonfun$expression$extension$1

at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:35)

at org.apache.activemq.command.ActiveMQObjectMessage.getObject(ActiveMQObjectMessage.java:179)

… 15 more

Caused by: java.lang.ClassNotFoundException: io.gatling.core.session.package$ExpressionWrapper$$anonfun$expression$extension$1

Any help will be appreciated.

The result of createObjectMessage is probably wrong.