RabbitMQ & MQTT : how to alert a third party of non consumed messages? - rabbitmq

I am using RabbitMQ with the MQTT plugin, with both producer and consumer on QoS=1.
I am still very new to RabbitMQ so I would like to understand if there is a way/efficient pattern to ensure a fallback in case a consumer is not consuming the messages of the topic he has subscribed to.
For instance, the idea being to be able to send an alert to a server trigger another channel (email, push notification) after a few seconds if a client is not consuming the messages of the MQTT topic?
Thank you for your help!

You can set per-message or per-queue TTL and then catch expired messages with the help of Dead Letter Exchanges extension. That will act as a notification of stalled or slow consumer or no consumers at all.

Related

How to push messages to AMQP consumer Artemis

Is it possible for Artemis to push messages to a REST API/consumer, rather the consumer pulling from it. I can implement a Listener on the consumer side, but I am trying to see if Artemis can push messages to consumers.
Any help is much appreciated.
Don't think it's possible, the JMS provider is a server and always waits for consumer connections. Then, it pushes messages to consumer's buffer as soon as it is ready and there are available messages. Anyway, depending on your application's technology, you may want to leverage the Artemis REST interface to implement your consumer.

Can consumers act as producers and send messages to the message broker in RabbitMQ?

Can we design pub-sub patterns in RabbitMQ where a consumer can also act as a producer and send messages to the message broker?
pub-sub with the same service
Did you try to use producer API in consumer code? It should work...
You can find API docs for many languages in Client Documentation
Regarding design, consumers may consume, do some processing and then produce - publish to some other exchange of the same or other messaging broker instance...
It's design decision...
Yes, the consumer can also act as a producer. It's a common use case that the consumer sends back a new message/task about something else once the first message has been processed.
Make sure that you separate the connections for the publisher and the consumer.
RabbitMQ can apply back pressure on the TCP connection when the publisher is sending too many messages for the server to handle. If you consume on the same TCP connection, the server might not receive the message acknowledgments from the client, thus effecting the consume performance. With a lower consume speed, the server will be overwhelmed.

Is there any way to tell rabbitMQ resend an unacknowledged message to a worker?

Hi there i have a rabbitMQ queue and just one worker to handle queued messages. I want to know is there any way to tell rabbitMQ if a message is unacknowledged send it again to worker periodically.
Very thanks in advance.
RabbitMQ will consider a message delivered and not yet acknowledged as being consumed. You cannot enforce it to be re-delivered as long as the consumer which fetched it does not close the channel or reject the message via the basic.reject AMQP method.
You can read more about publish/delivery confirmation in the documentation.

Monitoring Status of Message Sent to RabbitMQ via Web-Stomp web-socket

Using web-stomp with RabbitMQ and web-socket (SockJS not used), after sending a message to a queue, how can the consumer be notified by the broker or monitor that the sent message has been consumed?
I've experimented with subscribing to the queue which makes the client a consumer and the goal is not to receive the message for processing, but to know when a consumer elsewhere has picked up, acknowledged the message and is no longer in the queue.
In retrospect, I really do believe I'm breaking the spirit of "send it and forget it" with this question's approach.
The better approach will be to subscribe to another queue that will receive the "finished processing" message that will be sent from the processor. The client can take the appropriate actions from there.

RabbitMQ & Spring amqp retry without blocking consumers

I'm working with RabbitMQ and Spring amqp where I would prefer not to lose messages. By using exponential back off policy for retrying, I'm potentially blocking my consumers which they could be working off on messages they could handle. I'd like to give failed messages several days to retry with the exponential back off policy, but I don't want a consumer blocking for several days and I want it to keep working on the other messages.
I know we can achieve this kind of functionality with ActiveMQ(Retrying messages at some point in the future (ActiveMQ)), but could not find a similar solution for RabbitMQ.
Is there a way to achive this with Spring amqp and RabbitMQ?
You can do it via the dead letter exchange. Reject the message and route it to the DLE/DLQ and have a separate listener container that consumes from the DLQ and stop/start that container as needed.
Or, instead of the second container you can poll the DLQ using the RabbitTemplate receive (or receiveAndConvert) methods (on a schedule) and route the failed message(s) back to the primary queue.