Format ActiveMQ server like hdfs node format? - activemq

Is there any option or command line available to format (erase all data)ActiveMQ server like hdfs node format?
I have deleted the all Queues in ActiveMQ but still is has consumer 47% , how can format all data ?

Simple answer: Remove the kahadb folder pointed out by your persistence configuration and restart ActiveMQ. It will be recreated on startup if not present.
Longer answer: As long as there is a message or something going on, ActiveMQ will lock transaction log files where that message is. The log files will be cleaned up with some interval when there are no unconsumed messages within them. That might include unconsumed messages in durable subscriptions and other things.
You can also set the broker attribute deleteAllMessagesOnStartup in configuration and restart. That can be useful in some situations.

Related

Why ActiveMQ doesn't and console still shows messages after deleting db-*.log files from KahaDB

I am using KahaDB as a persistent storage to save message in ActiveMQ 5.16.4.
<persistenceAdapter>
<kahaDB directory="${activemq.data}/kahadb"
checkForCorruptJournalFiles="true"
checksumJournalFiles="true"
ignoreMissingJournalfiles="true"
/>
</persistenceAdapter>
I'm sending persistent messages and then while the broker is running I'm deleting the KahaDB log files (db-1.log in below picture) which are supposed to hold the queue's messages. However, but deleting the log file doesn't seems to do anything. In the ActiveMQ console I still see the persistent messages, and I can also send more messages which get picked up by connected consumer from Spring Boot apps. I thought deleting those log files will get rid of messages that are pending in queue or break ActiveMQ. Any idea why it isn't happening?
Inside KahaDB folder:
ActiveMQ doesn't treat KahaDB like a SQL database where messages are stored and retrieved during runtime. Generally speaking, ActiveMQ keeps all of its messages in memory and it uses KahaDB is a journal to store messages which it will reload into memory if the broker fails or is restarted administratively. Deleting KahaDB's underlying data won't impact what is in the broker's memory, and it's not clear why you would ever want to do this in the first place.
If you want to remove the messages from a queue during runtime you can do so administratively via the web console. Deleting the KahaDB log files is not the recommended way to do this.

Get dump of fuse activemq messages

I am running a production application with fuse esb and using fuse provided activemq queues. There are 100k messages in one of my queues and I need to get a dump of those messages without removing them from the queue. What is the method to get a dump of those messages.
I used activemq:browse karaf command and directed output to file.But it did not give me all the messages. Only 4000 messages were written to a file.
ActiveMQ cannot browse extremely deep Queues so you won't likely be able to view them all. The browse operation is limited to what can fit into the broker memory and by the maxBrowsePageSize setting.
There is no tooling to dump the contents of the message store offered in ActiveMQ. A broker is not a database and should not be treated as one, messages are meant for consumers to consume.

message deleted from queue

I have used BlockingQueue implementation to process my events by services from a queue. However in case if the server goes down, all my events from that queue are getting deleted and hence I am missing events to process. (I am looking for some internal DB where server can store the event/messages from queue and if server goes down and up again, it can load all events/messages to process again, without manually intervention).
Any help on this. I am not sure if I should use Apache ActiveMQ. I am using apache servicemix.
Thanks in advance.
I can not answer about how to do this with BlockingQueue.
But ActiveMQ has two features that you will benefit from:
Persistent Queues and possibly you might also want to look at Durable Queues
It has a built in database that just does this under the hood and allows messages to be persisted in queue even if broker or consumer has to restart.

RabbitMQ msg_store_transient directory eats all available disk space

I have a problem with RabbitMQ 2.8.2 server.
After one or two days usage I receive Disk Space warning from RabbitMQ and the only solution I found is to clear directory /var/lib/rabbitmq/mnesia/rabbit#linux-3blg/msg_store_transient and restart RabbitMQ. I use rather huge messages in my program 1-50MB may be problem is there, but I really need stability.
Does anybody knows the solution?
This means that messages are not being acknowledged and consumed. It might help to make use of the Time-To-Live Extensions. See http://www.rabbitmq.com/ttl.html#per-queue-message-ttl and set an expiration for messages.

How can messages in Activemq queue/topics be persisted while using KahaDB?

More specifically, right now when activemq is restarted, the enqueue/dequeue message count for queue and topic changes back to 0 but I would like activemq to persist messages using KahaDB so that even after an activemq restart the counter doesn't switch back to 0 but shows the cumulative count. Any pointers will really help.
I am using activemq version - 5.4.3 and all default settings.
Thank you in advance.
If you have KahaDB configured and are sending Messages with the persistent property enabled (the default) then they will be stored and reloaded for all the Queues or Topics that had durable subscribers.