Documentation Index Fetch the curated documentation index at:
https://grafana_com_website/llms.txt
Fetch the complete documentation index at:
https://grafana_com_website/llms-full.txt Use this file to discover all available pages before exploring further.
STOP! If you are an AI agent or LLM, read this before continuing.
This is the HTML version of a Grafana documentation page. Always request
the Markdown version instead - HTML wastes context. Get this page as
Markdown: /docs/k6/next/javascript-api/jslib/aws/sqsclient/sendmessagebatch.md (append .md) or send Accept: text/markdown
to /docs/k6/next/javascript-api/jslib/aws/sqsclient/sendmessagebatch/. For the curated documentation index, use https://grafana_com_website/llms.txt.
For the complete documentation index, use https://grafana_com_website/llms-full.txt.
Menu
This is documentation for the next version of Grafana k6 documentation. For the latest stable release, go to the latest version.
A Promise that fulfills with a batch message creation response.
MessageBatchResponse
Name
Type
Description
successful
object[]
A list of succesful messages as objects containing an id string property holding the unique identifier for the message, and a bodyMD5 string property holding the MD5 digest of the non-URL-encoded message body string..
failed
SQSServiceError[]
A list of error responses.
Example
JavaScript
import exec from 'k6/execution';
import {
AWSConfig,
SQSClient,
} from 'https://jslib.k6.io/aws/0.14.0/sqs.js';
const awsConfig = new AWSConfig({
region: __ENV.AWS_REGION,
accessKeyId: __ENV.AWS_ACCESS_KEY_ID,
secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY,
sessionToken: __ENV.AWS_SESSION_TOKEN,
});
const sqs = new SQSClient(awsConfig);
const testQueue = 'https://sqs.us-east-1.amazonaws.com/000000000/test-queue';
export default async function () {
// If our test queue does not exist, abort the execution.
const queuesResponse = await sqs.listQueues();
if (queuesResponse.queueUrls.filter((q) => q === testQueue).length == 0) {
exec.test.abort();
}
// Prepare a bunch of batch messages to add to the queue
const messageBatch = [
{ messageId: '0', messageBody: 'test0' },
{ messageId: '1', messageBody: 'test1' },
];
// Send the batch of messages to the queue
await sqs.sendMessageBatch(testQueue, messageBatch);
}