Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lucacasonato/deno_sqs
Amazon SQS for Deno
https://github.com/lucacasonato/deno_sqs
aws deno sqs
Last synced: 26 days ago
JSON representation
Amazon SQS for Deno
- Host: GitHub
- URL: https://github.com/lucacasonato/deno_sqs
- Owner: lucacasonato
- License: mit
- Created: 2020-07-16T21:51:41.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-07-26T15:54:37.000Z (over 2 years ago)
- Last Synced: 2024-10-06T10:49:00.735Z (about 1 month ago)
- Topics: aws, deno, sqs
- Language: TypeScript
- Homepage:
- Size: 41 KB
- Stars: 6
- Watchers: 2
- Forks: 4
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# deno_sqs
[![deno doc](https://doc.deno.land/badge.svg)](https://doc.deno.land/https/deno.land/x/[email protected]/mod.ts)
Amazon SQS for Deno
> ⚠️ This project is work in progress. Expect breaking changes.
## Examples
```ts
import { SQSQueue } from "https://deno.land/x/[email protected]/mod.ts";// Create a queue using the queue url and credentials
const queue = new SQSQueue({
queueURL: "https://sqs.us-east-2.amazonaws.com/123456789012/MyQueue/",
accessKeyID: Deno.env.get("AWS_ACCESS_KEY_ID")!,
secretKey: Deno.env.get("AWS_SECRET_ACCESS_KEY")!,
region: "us-east-2",
});// Send a message to this queue and print the message ID.
const res = await queue.sendMesssage({ body: "Hello World!" });
console.log("Sent message with id ", res.messageID);// Receive a message from the queue:
const { messages } = await queue.receiveMessage();
for (const message of messages) {
console.log("Recieved message ", message.messageID, "and body", message.body);// Delete the message after receiving it
await queue.deleteMessage(message.receiptHandle);
}
```## Contributing
To run tests you need to have a S3 bucket you can talk to. For local development
you can use min.io to emulate an S3 bucket:```
export AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE
export AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
docker-compose up -d
aws --endpoint-url "http://localhost:9324" sqs create-queue --queue-name test --region us-east-1 --attributes VisibilityTimeout=0
deno test --allow-net --allow-env
```