Giter Site home page Giter Site logo

Comments (4)

naveenincture avatar naveenincture commented on May 28, 2024

I am able to solve this by adding "autoDelete" tag in the declare.

.declare(queue("measurement_data_hino_us_pilot_uat",autoDelete = false))

I am trying to publish 100kb json date. I have stored the data in file and i am trying to use the file name in "textMessage" attribute. I am not able publish the data, could you please help with this ?

package simulations

import io.gatling.core.Predef._
import io.gatling.core.structure.{ChainBuilder, ScenarioBuilder}
import ru.tinkoff.gatling.amqp.Predef._
import ru.tinkoff.gatling.amqp.protocol.AmqpProtocolBuilder

class PublishWithFeeeder extends Simulation{

//val publishMessage = ElFileBody("src/test/resources/testData/publish.json")
val publishMessage = jsonFile("src/test/resources/testData/publish.json")

val amqpConf: AmqpProtocolBuilder = amqp
.connectionFactory(
rabbitmq
.host("hasty-whale.rmq.cloudamqp.com")
.port(5672)
.username("HINO_US_PILOT_Fleet_Management")
.password("RVkjh2pFu18KGVCc")
.vhost("fdc97e13-563c-41b1-843b-1ecf7dbc62d3")
)
.declare(queue("measurement_data_hino_us_pilot_uat",autoDelete = false))

def publishMessageWithFeeder(): ChainBuilder ={
repeat(1){
.exec(
amqp("publish to us_pilot_uat")
.publish
.queueExchange("measurement_data_hino_us_pilot_uat")
.textMessage("$publishMessage")
.priority(0))

}

}

val scn = scenario("Message Publish with Feeder")
.exec(publishMessageWithFeeder())

setUp(
scn.inject(atOnceUsers(1))).protocols(amqpConf)
}


also, i tried to add validaiton like "check" and its not available. Could you please help on this as well ?

from gatling-amqp-plugin.

red-bashmak avatar red-bashmak commented on May 28, 2024

Hello @naveenincture.

  1. jsonFile works differently, look in the gatling documentation.
    In your case ElFileBody is correct solution, but you need to save file content in session before use it in textMessage .
    Something like this may help:
import io.gatling.commons.validation.SuccessWrapper
...
 val publishMessage = ElFileBody("testData/publish.json").expression
...
.exec { session =>
      for {
        json <- publishMessage(session)
        r    <- session.set("publishMessage", json).success
      } yield r
    }
    .exec(
     amqp("publish to us_pilot_uat")
       .publish
       .queueExchange("measurement_data_hino_us_pilot_uat")
       .textMessage("$publishMessage")
       .priority(0))
  1. check is not available because publish only publish message and not receive response. And for check need response. If you need response use requestReply

from gatling-amqp-plugin.

naveenincture avatar naveenincture commented on May 28, 2024

@red-bashmak

Thank you :) I am able to publish the message using ElFileBody as below.

Really appreciate the reply. I am getting started with Gatling and facing an another issue. I have seeked help from community as well. It would be really helpful, if you can give some inputs.


package simulations

import io.gatling.core.Predef._
import io.gatling.core.structure.{ChainBuilder, ScenarioBuilder}
import ru.tinkoff.gatling.amqp.Predef._
import ru.tinkoff.gatling.amqp.protocol.AmqpProtocolBuilder

class PublishWithFeeeder extends Simulation{

val csvFeederVINNumber = csv("testData/vinNumber.csv").circular

val amqpConf: AmqpProtocolBuilder = amqp
.connectionFactory(rabbitmq
.host("hasty-whale.rmq.cloudamqp.com")
.port(5672)
.username("username")
.password("password")
.vhost("host"))
.declare(queue("measurement_data_hino_us_pilot_uat",autoDelete = false))

def publishMessageWithFeeder(): ChainBuilder ={
feed(csvFeederVINNumber)
.exec(amqp("publish to us_pilot_uat")
.publish
.queueExchange("measurement_data_hino_us_pilot_uat")
.textMessage(ElFileBody("testData/publish.json"))
.priority(0)
.contentType("application/json"))
.pause(1)
}

val scn: ScenarioBuilder = scenario("Message Publish with Feeder")
.exec(publishMessageWithFeeder())

setUp(
scn.inject(atOnceUsers(1))).protocols(amqpConf)
}


Issue Link : https://stackoverflow.com/questions/66950680/using-timestamp-in-json-file-in-gating
Description :

I have json file in below format

Scenario :

Publishing message into RabbitMQ using Gatling.
I have saved the json file in resource folder.
Passing json file using "ElFileBody" builder.
i have to get the current timestamp and increment current time accordingly in the downstream timestamps. Attached below ex
Could you please help in generating the timestamp, how can we increment/decrement the current timestamps by seconds/minutes/hours/days and pass directly in json file.

{
"series": {
"uid": "60329dd7-cc15-43ca-ac5d-6907126b017a",
"seriesName": "APP",
"valueType": "DOUBLE",
"description": "",
"signalCollectionId": "ed6a6744-32c7-4f96-969c-8e1bd1b26f41",
"sourceId": "70f15369-9ac0-4533-8f49-c7f0326a2a05",
"sourceName": "v7r2_J_ENG_DEC",
"unit": "%",
"protocol": "CAN_RAW",
"type": "SIGNAL",
"samplingRate": 1000
},
"dataPoints": [
{
"uniqueId": "34ad93e0-bdb3-4cbc-8354-ab59a808960f",
"timeStamp": "2021-03-15T13:13:01.111Z", //Current timestamp
"value": 0
},
{
"uniqueId": "f901ec1e-5fd5-4015-97ad-b14aadae17ff",
"timeStamp": "2021-03-15T13:13:11.111Z", //Current timestamp + 10 seconds
"value": 0
},
{
"uniqueId": "abc79341-2388-447c-8bd1-4671c791f9b9",
"timeStamp": "2021-03-15T13:13:21.111Z", //Current timestamp + 20 seconds
"value": 0
}
]
}

Thank you :)

Naveen.

from gatling-amqp-plugin.

antonydevanchi avatar antonydevanchi commented on May 28, 2024

Наркоманы, грохните тред к хуям, там же креды к AMQP инстансу попалены.
Инстанс живой, там что-то вертится, какие-то данные в наличии.

FYI @naveenincture use translate.google.com, please. I'm just fuck English in 04:30 AM, sorry.
FYI @red-bashmak @icyberdeveloper [email protected]

from gatling-amqp-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.