PubSub consumer never consumes messages with RabbitSubscribe
See original GitHub issueHello,
I have an issue with consuming messages in a pubsub maner. I am able to create a connection to the exchange and to publish messages on it (confirmed on the UI).
I do not understand why my function associated with RabbitSubscribe is never called. I have triple checked the exchange and route key and it is correct.
In my Module I use :
RabbitMQModule.forRoot(RabbitMQModule, {
exchanges: [
{
name: 'exchange1',
type: 'fanout',
},
],
uri: 'amqp://localhost:5672',
connectionInitOptions: { wait: false },
}),
And my service :
import { Injectable } from "@nestjs/common"
import { AmqpConnection, RabbitSubscribe } from "@golevelup/nestjs-rabbitmq"
@Injectable()
export class MailService {
constructor(private readonly amqpConnection: AmqpConnection) {
// setTimeout(function() {
// console.log("inside")
// amqpConnection.publish("exchange1", "subscribe-route", { msg: "hello world" })
// }, 3000)
}
@RabbitSubscribe({
exchange: "exchange1",
routingKey: "subscribe-route",
queue: "subscribe-queue",
})
public async pubSubHandler(msg: {}) {
console.log(`Received message: ${JSON.stringify(msg)}`)
}
}
Is there something I am missing ? Thanks
Issue Analytics
- State:
- Created 2 years ago
- Comments:9
Top Results From Across the Web
Handle message failures | Cloud Pub/Sub
This page explains how to handle such processing failures by using a subscription retry policy or by forwarding undelivered messages to a dead-letter...
Read more >RabbitMQ tutorial - Publish/Subscribe
A consumer is a user application that receives messages. The core idea in the messaging model in RabbitMQ is that the producer never...
Read more >RabbitMQ Plugin - GitHub Pages
3 Sending Messages. 4 Consuming Messages. 4.1 Pub-Sub. 4.2 Manual queue management. 4.3 Messages. 5 Using The RabbitTemplate Directly ...
Read more >Google Pub/Sub Subscriber not receiving messages after a ...
My application uses python and a lot of processing power in a Google Cloud Engine. What do you think would be the best...
Read more >Cloud Pub/Sub - Spring Boot on GCP
Cloud Pub/Sub delivers messages with guaranteed at-least-once delivery, ... A Spring Cloud Stream consumer to consume messages is simply a Java Consumer ....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
No problem. I’m going to close this now as the root cause has been identified and will track any additional info in the dedicated issue for microservices support
@LucSalommez Unfortunately the library isn’t a “true” NestJS microservice at the moment so we can’t rely on
startAllMicroservicesAsync
to establish listeners at the moment. I’ll need to look into this a bit more and see what solutions make senseTracking this with #274