Hi I am using gatling JMS to publish message into queue.
After successful trigger, the message persisted into local DB.
Now, I want to check that the message really persisted into DB or not using assertions.
I mean the value which I am sending is really persisted in DB?
Please check the below simulation.
class MessageSimulation extends Simulation {
before {
println(" ========= Starting JMSSimulation ========= ");
println(s"AMQ Server: ${JMSConfig.amqServer}")
println(s"AMQ Usr: ${JMSConfig.amqUsr}")
println(s"AMQ Pwd: ${JMSConfig.amqPwd}")
println(s"In Queue: ${JMSConfig.inQueueName}")
configureFor(LoadTestHelper.getMockHost(), 8080)
println("Setup Complete")
}
var jmsPostScenario = MessageScenario;
setUp(
jmsPostScenario.jmsScenario.inject(
nothingFor(5),
atOnceUsers(1)).protocols(JMSConfig.jmsConf))
.assertions(global.successfulRequests.percent.gte(90))
.maxDuration(120)
}
My Simulation is below
object MessageScenario {
val platformIdentifier = PlatformIdentifier.EMPTY.toString()
val clientId = "loadTest_" + Random.alphanumeric.take(23).mkString
val postPositionsEvent = scenario("Message Scenario").repeat(1) {
val source = Source.fromURL(this.getClass.getResource("/tsa_v1.xml"))
val body = try source.mkString finally source.close()
var msgVersionJMS = Header.MSG_VERSION.jms()
var msgTypeJMS = Header.MSG_TYPE.jms()
var trackingIdJMS = Header.TRACKING_ID.jms()
var clientIDJMS = Header.CLIENT_ID.jms()
exec { session =>
session
.set("platformIdentifier", platformIdentifier)
.set("label", platformIdentifier)
}
//.feed(postTestData)
.exec(jms("MSGScenario").send
.queue(JMSConfig.inQueueName)
.textMessage(StringBody(body))
.property(msgVersionJMS, "1")
.property(msgTypeJMS, "TSA_NOTIFICATION")
.property(trackingIdJMS, PlatformIdentifier.create().toString())
.property(clientIDJMS, clientId)
.property("notificationtype", "JMS_POST")
.property("JMSCorrelationID", "corrID" + PlatformIdentifier.create().toString()))
}.pause(20)
def jmsScenario: ScenarioBuilder = {
postPositionsEvent
}
}
Can any one help me on this.
Thanks,
Naveen