Accessing RabbitMQ logs in real time - rabbitmq

I came across an interesting subject when reading the book "RabbitMQ in Action" by Manning. Apparently it's possible to set up consumers to be able to receive all RabbitMQ logging in real time in the consumer.
I read that RabbitMQ publishes logging to an exchange of type topic called amq.rabbitmq.log. Consumers can listen to specific severity levels, for example it can be filtered by setting the routing key to error, warning or info.
My question is; I installed a default RabbitMQ server on my PC, but I couldn't find any exchange called amq.rabbitmq.log. Only one which could be related is amq.rabbitmq.trace, but this one is used for events (events like queue.deleted, queue.created, ...), in other words that one is not what I'm looking for.
Can anyone bring clarification to my questions? Why is the amq.rabbitmq.log exchange not available on a clean RabbitMQ server installation?
citation:
Perhaps when you were listing exchanges using rabbitmqctl you spotted
an exchange called amq.rabbitmq.log whose type is topic. RabbitMQ will
publish its logs to that exchange using the severity level as a
routing key - you'll get error, warning and info. Based on what you
learned from the previous chapters you can create a consumer to
listen to those logs and react accordingly.

You have to enable it. Create the /etc/rabbitmq/rabbitmq.conf file and ensure that this line is present in it:
log.exchange = true
I just grepped the source for the rabbitmq.com website and don't see that setting documented anywhere. If you'd like, file a new issue in that repository and I'll fix it, or open your own PR to do so.
NOTE: the RabbitMQ team monitors the rabbitmq-users mailing list and only sometimes answers questions on StackOverflow.

It is a bit late, but hope it help someone. So far it works for me. The exchange "amq.rabbitmq.log" will be created automatically by the rabbitmq broker itself. The RabbitMQ broker version that I am using is: 3.8.1
add
log.exchange = true
into your rabbitmq.conf file and restart your rabbitmq service.
You will need to restart your rabbitmq service everytime you had updated the rabbitmq.conf file.
open cmd and enter the following in windows:
rabbitmq-service stop
rabbitmq-service install
rabbitmq-service start
rabbitmqctl start_app

Related

RabbitMQ crashes when entering UI

I was testing RabbitMQ using a script, I added 500,000 bindings to different routing keys on an exchange. Only when I try to enter the rabbit's UI - the exchange page, the page fails to load and the rabbit server crashes.
Is this a known issue? Is it a memory problem?
Is this a known issue? Is it a memory problem?
The answers are "No" and "Maybe".
You haven't given basic information like RabbitMQ, Erlang and operating system version. I'm assuming you have a script to add that many bindings. If you'd like to share the required information on the mailing list the team may be able to help out.
NOTE: the RabbitMQ team monitors the rabbitmq-users mailing list and only sometimes answers questions on StackOverflow.

Can you subscribe and publish to the same ActiveMQ topic

I have a software component that puts a message on a topic - its for 'keep-alive' functionality, testing to see if the components are still running. The component that puts the message on the topic also needs to listen on the same topic. ActiveMQ isn't responding - i.e. the subscribe isn't working for the item that published.
Is there a setting anywhere in ActiveMQ where this functionality can be changed?
We're currently developing on a single node, but will be deploying to multiple nodes, where it will be important for this message to be picked up by the same software component on other nodes, but we haven't tried that yet and don't know if it will work, or how reliable that is. We would be okay if the behaviour was known (i.e. a setting somewhere in the ActiveMQ configuration exists), but we don't.
ActiveMQ has no limitation that would cause this. Check the 'noLocal' setting on your JMS subscriber. If set to 'true' it will ignore messages that are produced from the same connection.
Sounds like you want noLocal=false

Automatic timestamp generator plugin on RabbitMQ broker

I've searched a lot on Google or directly on Stackoverflow and I know that AMQP's timestamp message property must be filled by the producer.
But I want to know if there is some plugin that writes out on this parameter based on the broker's local timestamp automatic when the message is putted on each queue by a topic exchange.
I'm on a situation that neither producer's nor consumer's timestamps are reliable. Only the broker has a trustworthy watch.
I'm not an Erlang programmer but, if there is no known plugin to do that, I need some help. How could I start to write it myself?
I just need to:
Publish some message by someone who doesn't rely on his local timestamp.
Put this message on each queue mapped on my broker's topic exchange (with it's local timestamp, now I need only this step)
Finally, anyone for whom this message was addressed to is able to get the message and see the exact time this message landed on the broker.
I'm using RabbitMQ 3.3.4, Erlang R16B03, on an Ubuntu's new Amazon AWS machine.
Thanks
First try official Plugin Development Guide. Also look through official and community plugins and their sources. In addition you can always googled any other rabbitmq plugins not listed in lists above. Finally, there are official RabbitMQ mailing list on google groups (replaced http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss).

Tool for sending messages to ActiveMQ manually

I have worked on IBM MQ and this is the first project where I am to work on ActiveMQ. After reading basic tutorial I found that both are similar. So I started creating small applications to listen to some queues.
Working with IBM MQ, I used to use RFHUtil tool to browse/send messages to queue which provided features to set message headers as well.
In activeMQ I am sending messages from localhost admin console. I do not find options to set message header from here. For example if I want to set source system in the message header. Is there any way/tool to get this feature on activeMQ?
I like hermes jms
Be sure to pick the Head version if you want support for headers. Its pretty similar to RFHUtil but allows "all" JMS providers.
http://hermesjms.com/patches/
I also made a command line tool for the same task which is handy, called A.

How to debug ActiveMQ client?

I'm a fairly new user of ActiveMQ and I'm looking for a way to get detailed debug information on the client side of a queue connection. My problem is this: I have a server that is sending a message through a queue to a client. Using the admin web page associated with the broker, I can verify the following: the queue was created, there is a consumer associated with the queue, the message has been enqueued, the message has been dispatched, the dispatched queue size is 1, the message has not been dequeued. This setup was working yesterday but mysteriously stopped working today even though I did a restart of the activemq service. The log file at /var/log/activemq.log does not contain any useful information.
At this point I'm stumped; I'm assuming that there is some sort of problem with the configuration, but it hasn't changed since yesterday. Does anybody have a suggestion about what my next step should be?
Turn on debug (or even trace) logging in the broker first of all in conf/log4j.properties.
log4j.logger.org.apache.activemq=DEBUG
restart the broker and re-run your scenario. The logging will hopefully provide you with some information.
Jconsole is also a useful tool to monitor the running broker.
Does your client use any message filters?
You can also enable remote debugging and then connect with an IDE.
To start remote debugging execute
$ ACTIVEMQ_DEBUG=true bin/activemq
and then start a remote debugger to connect to port 5005