msqar
msqar

Reputation: 3020

How could i persist ActiveMQ messages?

Found that KahaDB is installed in ActiveMQ by default. Found a db.data file, when I open it (its a config file), i saw this:

#
#Fri Aug 02 11:55:47 ART 2013
fileType=org.apache.activemq.store.kahadb.disk.page.PageFile
pageSize=4096
freePages=1
cleanShutdown=false
metaDataTxId=7
fileTypeVersion=1
lastTxId=52967
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            #
#Fri Aug 02 11:55:47 ART 2013
fileType=org.apache.activemq.store.kahadb.disk.page.PageFile
pageSize=4096
freePages=1
cleanShutdown=false
metaDataTxId=7
fileTypeVersion=1
lastTxId=52967

Repeated twice. Should i edit it with Notepad++ or another program? If not, if i add persistence attributes in there, should i add it twice too?

Is it possible to persist the message info by using KahaDB? I would need something like: TIMESTAMP, MESSAGE_ID, REPLY_TO

That kind of data only.

Tried using log4j and kahadb but didn't log what i needed actually. This is my log4j.properties file

# Default log level
log4j.rootLogger=DEBUG, kahadb

# KahaDB configuration
log4j.appender.kahadb=org.apache.log4j.RollingFileAppender 
log4j.appender.kahadb.file=logs/data/kahadb.log 
log4j.appender.kahadb.maxFileSize=1024KB 
log4j.appender.kahadb.maxBackupIndex=5 
log4j.appender.kahadb.append=true 
log4j.appender.kahadb.layout=org.apache.log4j.PatternLayout 
log4j.appender.kahadb.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n 
log4j.logger.org.apache.activemq.store.kahadb.MessageDatabase=TRACE, kahadb

Thanks.

Upvotes: 2

Views: 1624

Answers (1)

Tim Bish
Tim Bish

Reputation: 18366

Its not really clear what your problem is here. By default the broker will use its internal KahaDB store to persist all Messages sent to a Queue or Durable Topic subscription if those messages are sent with the delivery mode of persistent. There's no reason to edit any of the KahaDB files such as db.data or db.log as this will corrupt your store. You can read about the store architecture and performance tuning the store here.

There is a wealth of info out there on KahaDB that can be found with just a simple Google search.

Upvotes: 2

Related Questions