Error in using SendMessageBatch SQS

I want to send these multiple json messages in our sqs using SendMessageBatchrequest. However, I am encountering an error ‘Cannot resolve overloaded method SendMessageBatch’. I did already checked the aws site and I cannot understand how to use the syntax documentation on its usage. If you have any better idea on how to send multiple json message to the SQS queue, feel free as I am new to scala and testing an aws sqs services.Thank you.

class batchmessage extends Simulation{

  val devQueueUrl = "queueurl"
  val endpoint = "endpoint"
  val accessKey = "access key"
  val secretKey = "secret key"
  val session_token = "session token"
  val batchSize = 10
  val awsCreds = new BasicSessionCredentials(accessKey, secretKey, session_token)

val messageBody = 
"{\n  \"Type\": \"Notification\",\n  \"MessageId\": \"57d0854f-e30c-4ad1-9a4e-f406b485181a\",\n  \"TopicArn\": \"arn:aws:sns:eu-west-1:22079:test-Topic\",\n  \"Message\": \"{\\\"idAnnonce\\\":381190784,\\ ....

"{\n  \"Type\": \"Notification\",\n  \"MessageId\": \"57d0854f-e30c-4ad1-9a4e-f406b485181a\",\n  \"TopicArn\": \"arn:aws:sns:eu-west-1:22079:test-Topic\",\n  \"Message\": \"{\\\"idAnnonce\\\":381190785,\\ ....

"{\n  \"Type\": \"Notification\",\n  \"MessageId\": \"57d0854f-e30c-4ad1-9a4e-f406b485181a\",\n  \"TopicArn\": \"arn:aws:sns:eu-west-1:22079:test-Topic\",\n  \"Message\": \"{\\\"idAnnonce\\\":381190786,\\ ...


  var client: AmazonSQS = AmazonSQSClientBuilder
    .standard()
    .withCredentials(new AWSStaticCredentialsProvider(awsCreds))
    .withEndpointConfiguration(new EndpointConfiguration(endpoint, Regions.EU_WEST_1.getName)) 
    .build()

  val scn: ScenarioBuilder = scenario("SQS Perf Test")
    .exec(session => {
      val request = {
        new SendMessageBatchRequest(devQueueUrl, messageBody)
      }
      client.sendMessageBatch(request)
      session
    }
    )

  setUp(
    scn.inject(
 
      constantUsersPerSec(2) during (50 seconds) // 100
    //constantUsersPerSec (300) during (333 seconds) // 1M
    //              constantUsersPerSec(300) during (160 seconds) // 0.5M
    //constantUsersPerSec (100) during (10 seconds) // 10K
    // other example: Let's have 10 regular users and 2 admins, and ramp them over 10 seconds so we don't hammer
    // the server
    //users.inject(rampUsers(10).during(10)), admins.inject(rampUsers(2).during(10))
    //).protocols(jmsProtocol)
  ).protocols()

@slandelle I cannot tell what modification had you done.

Hi @Julius,

Usually, when we (admins) edit user’s post, it’s only for formatting reason. In this case, to make the code looks like code.

About your question… There is nothing to do with Gatling, as you directly use the SQS client (from AWS sdk, I guess).
If you struggle with Scala, do you know there is a Java/Kotlin DSL as well?

Cheers!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.