I am using Spring, Spring-Websocket, STOMP for my application, and RabbitMQ as broker. I need to log all messages going through RabbitMQ to Postgresql tables. I know that I can write @MessageMapping in Spring and log there, but my problem is that some clients talk to RabbitMQ directly through MQTT protocol, and Spring does not support it yet (https://jira.spring.io/browse/SPR-12581). Moreover browser clients talk through Spring to RabbitMQ using STOMP protocol.
RabbitMQ allows to track all messages using Firehose tracer. How to properly listen to amq.rabbitmq.trace topic from Spring? Or do I need to write separate Java app as consumer?
exports = (connection, queue) => { init(connection, queue); return { getMessages: (queueName, cleanQueue) => new Promise((resolve) => { let messages = []; let i = 1; getChannel(). then((ch) => { ch. consume(queueName, (msg) => { messages. push(msg); console.
In the Managed Service for ClickHouse cluster, create a table on the RabbitMQ engine. Send the test data to the RabbitMQ queue. Check that the test data is present in the Managed Service for ClickHouse cluster table. Delete the resources you created.
In order to consume messages there has to be a queue. When a new consumer is added, assuming there are already messages ready in the queue, deliveries will start immediately. The target queue can be empty at the time of consumer registration. In that case first deliveries will happen when new messages are enqueued.
The Spring AMQP is for you!
You bind some custom queue
to to that amq.rabbitmq.trace
with appropriate pattern (e.g. publish.#
) and configure SimpleMessageListenerContainer
to receive messages from that queue.
It can be done even with pretty simple config: @EnableRabbit
and @RabbitListener
on some POJO method. Anyway the Binding
@Bean
must be there to attache your queue to that exchange.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With