[ ] Regression
[ ] Bug report
[x] Feature request
[x] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
Working with nest.js these past few months has changed my approach to development in a positive way. Fantastic project!
We run stateless microservices written in node.js and managed by Kubernetes, and we make heavy use of AWS SQS/SNS. I haven鈥檛 been able to find any examples of nest.js with SNS/SQS - if I were to build out support for this should I be looking at the microservices module? I was thinking of making a custom Transport type for SQS/SNS. Let me know if I鈥檓 on the right track.
Thank you.
Nest version: X.Y.Z
For Tooling issues:
- Node version: XX
- Platform:
Others:
Hey @damianesteban!
PRs are open, feel free to create one, either idea is fine :)
Thanks. I'll be working on this project over the next month or so.
I stated a package a while ago for simple AMQP usage like a simple queue system with process workers etc. It's not currently the best package in the world and I'll be looking to make improvements for it in the future. Don't know if it's any good for you? It does need some updating, improvements and some serious love! Next time I require anything to do with AMQP I'll improve it.
I haven't much of a chance to work on this but I think this library will help - I'm still getting the hang of Nest in some areas. I'll likely use this as the base : https://github.com/bbc/sqs-consumer
Thank you.
+1 for this, specifically SQS. If anyone has any ideas on implementing sqs-consumer or long polling to SQS and NestJS, that would be great.
I haven't forgotten about this, its just been on the backburner 馃崝. I have a pretty good idea of how to implement it.
I haven't forgotten about this, its just been on the backburner 馃崝. I have a pretty good idea of how to implement it.
Would you be able to share that implementation by chance? I have sqs-consumer and NestJS working together but sometimes messages are not handled (in main.ts, I start the NestJS app and then service classes in which define a sqs-consumer instance in their constructor.).
main.ts
await app.listenAsync(PORT);
const sqsConsumer = app.get(MySqsConsumerService);
await sqsConsumer.start();
console.log('SQS Consumer Started');
my-sqs.consumer.ts
@Injectable()
export class MySqsConsumerService {
public consumer: Consumer;
constructor(
) {
this.consumer = Consumer.create({
queueUrl: 'QueueURLhere',
sqs,
handleMessage: async message => this.handleMessage(message),
});
}
async start() {
await this.consumer.start();
}
async handleMessage(message): Promise<void> {
const body = JSON.parse(message.Body);
console.log('Message Body:', body);
}
}
Any ideas?
@kamilmysliwiec going to attempt an SQS microservice if that's ok? I'll see what I can do!
Sure thing! @bashleigh
Any recommendations on this? We plan to use Nest for our micro service project based on aws lambda and would be really awesome to have SNS/SQS support.
@kop7 I've built something. I just haven't tested it yet and been mega busy with a new job! https://github.com/bashleigh/nest/commit/67eda61d546afaf7dbfadcfb8235e7c4e01f5624
Think I've got to make a few changes regarding importing of interfaces from an optional package etc
@justinwilson-apollidon I would recommend running SQS consumer as a separate process (take a look at https://12factor.net/).
Let's track this here https://github.com/nestjs/nest/issues/3960
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
@kamilmysliwiec going to attempt an SQS microservice if that's ok? I'll see what I can do!