Hi everyone,
I’m experience a problem something that I don’t know how to fix it.
I use Gatling for preformance testing on our JMS, with single (xml) requests I’ve got it working with an custom messagematcher.
However now I’m facing a problem I don’t know how to fix it, or even if that Gatling can do this.
I am sending a single request which include multiple transaction/orders (big xml), in this XML i’ve got multiple transactions which our system gives an reply to.
This means for example: 1 requests (with 10 transactions) gives 10 replies, however gatling will process this as 1 requests.
I know i can create something custom for matching the multiplie replies and have this reported outside of Gatling, but we like the gatling reporting.
So i was wondering, can i make Gatling match & report multiple replies when i am sending one request?
Kind regards,
Mitch
Hi,
Sadly no, it’s not supported atm.
Contributions welcome !
Regards
If some else got the same problem, this is how i semi-fixed it. This gives an report how long it will take to process all my requests as one request.
Note: i’ve saved/generated my id’s in an list(RequestsIDS) when generating the request(xml), ResponseIDS starts as an empty list.
object CustomXMLMatcher extends JmsMessageMatcher {
override def prepareRequest(msg: Message): Unit = {}
override def requestMatchId(msg: Message): String = getIdFromRequest(msg)
override def responseMatchId(msg: Message): String = getIdFromResponse(msg)
def getIdFromRequest(msg: Message): String = try {
//Because gatling sees it as only 1 request, chaned the requestid to customstring to match when all are matched
requestId = "MATCHID"
requestId
}
// having a try without a catch, gives warning in Gatling/Scala, removed it in this example for readability
def getIdFromResponse(msg: Message): String = try {
val xmlString = msg.asInstanceOf[TextMessage].getText
val xml = scala.xml.XML.loadString(xmlString)
val id = xml \\ "ID"
var responseId = id.text.toString
// loop true all my requests to see if matches the reply
for (id <- RequestIDS) {
if(responseId.contains(id.toString)){
ResponseIDS += id
}
}
// if response array is equal to request array all messages are matched
if (RequestIDS.length == ResponseIDS.length) {
// all requestids are gotten back so now we can match to the request message
responseId = "MATCHID"
}
responseId
}