Skip to content

Instantly share code, notes, and snippets.

@vhutov
Created March 12, 2018 23:10
Show Gist options
  • Save vhutov/039471f6a4fbdbbc73f732105e4f973e to your computer and use it in GitHub Desktop.
Save vhutov/039471f6a4fbdbbc73f732105e4f973e to your computer and use it in GitHub Desktop.
import scala.concurrent.duration._
import io.gatling.core.Predef._
import Predef._
class Test extends Simulation {
val kafkaP = kafkaProtocol.properties(Map("bootstrap.servers" -> "localhost:9092"))
val jmsP = jmsProtocol.url("localhost:7222")
val action = generic("request")
.send(extractMessage)
.via(kafka[MyMessage].topic("some_topic").withKeyExtractor(msg => Some(msg.id)))
.receive(jms.queue("some_queue").timeout(3 seconds))
//...
private def extractMessage(session: Session) = MyMessage(session("id").as[String])
case class MyMessage(id: String) extends Message
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment