JMS消息以加特林格式发送,但未收到回复-我在哪里错了?

问题描述 投票:0回答:1

我不熟悉Gatling和JMS的测试。从长远来看,我将希望Gatling拥有一个JMS侦听器,等待将JMS消息从我们的AUT放入队列中,但是现在,我只是在沙盒中玩游戏,以尝试掌握Gatling的JMS处理。我一直在看谷歌搜索向我投掷的各种示例,而我想出的最好的例子如下:

package jmspublisher

import io.gatling.core.Predef._
import io.gatling.jms.Predef._
import javax.jms._
import scala.concurrent.duration._

    class WebProducer extends  Simulation{

  // create a ConnectionFactory for ActiveMQ
  // search the documentation of your JMS broker
  val connectionFactory =
    new org.apache.activemq.ActiveMQConnectionFactory("tcp://localhost:61616")


  val jmsUsername:String="admin"
  val jmsPwd:String="admin"

  val jmsConfig = jms
    .connectionFactory(connectionFactory)
    .usePersistentDeliveryMode
    .matchByCorrelationId

  val scn = scenario("JMS DSL test").repeat(1) {
    exec(jms("req reply testing").requestReply
      .queue("jmstestq")
      .replyQueue("repQueue")
      .textMessage("hello from gatling jms dsl")
      .jmsType("textMessage")
      .check(simpleCheck(checkBodyTextCorrect)))
  }
      setUp(scn.inject(atOnceUsers(1))).protocols(jmsConfig)         

  def checkBodyTextCorrect(m: Message) = {
    print ("here")
    print (m);  
    // this assumes that the service just does an "uppercase" transform on the text
    m match {
      case tm: TextMessage => tm.getText == "HELLO FROM GATLING JMS DSL"
      case _               => false
    }
  }
}

[我可以在我的activeMQ控制台中看到创建了两个队列,在jmstestq上排队了一条消息,并且repQueue在运行期间连接了一个侦听器-但是repQueue似乎从未从jmstestq那里得到消息。 ,因此永远不会收到响应,也永远不会进行检查。

我确定我缺少简单的东西-但这是什么?!

jms gatling
1个回答
0
投票

但是您有一个示例AUT,它从repQueue读取然后在repQueue中写入响应消息?

© www.soinside.com 2019 - 2024. All rights reserved.