Skip to content

Commit

Permalink
docs(supplemental-docs): add documentation for using queue names with…
Browse files Browse the repository at this point in the history
… SQS Client (#6337)

Co-authored-by: RanVaknin <RanVaknin@users.noreply.github.com>
  • Loading branch information
RanVaknin and RanVaknin authored Jul 30, 2024
1 parent d8f767a commit 9f4b6df
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion supplemental-docs/CLIENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -618,4 +618,30 @@ new S3Client({
### SQS
TODO e.g. `useQueueUrlAsEndpoint`
#### Using Queue Names with SQS Client
When using the SQS client, set the `useQueueUrlAsEndpoint` configuration to `false` to allow for providing the `QueueUrl` parameter as a queue name rather than a full queue URL.
```js
import { SQSClient, SendMessageCommand } from "@aws-sdk/client-sqs";

const sqs = new SQSClient({
region: "us-east-1",
useQueueUrlAsEndpoint: false,
});

const QueueName = "foo"; // directly use the queue name
// const QueueUrl = "https://sqs.us-east-1.amazonaws.com/123456789012/foo"; // full URL for reference

try {
await sqs.send(
new SendMessageCommand({
QueueUrl: QueueName,
MessageBody: "Sample message",
})
);
console.log("message sent successfully");
} catch (error) {
console.log("SendMessage Failure", error);
}
```

0 comments on commit 9f4b6df

Please sign in to comment.