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.
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 dapoints. 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.
I am closing your problem because it is not related to any bugs in the plugin. To make what you want, you need to read the documentation for java.time package
@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 dapoints. 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.