I was bored watching TV yesterday night...
and as I was watching it.. I wrote the Export / Import tool for the Journal:
How it works...
I wrote two main classes at org.hornetq.core.journal.impl which will be part of hornetq-core.jar
to export the journal to a TXT file, you have to do:
java -cp hornetq-core.jar org.hornetq.core.journal.impl.ExportJournal <JournalDirectory> <JournalPrefix> <FileExtension> <MinFiles> <FileSize> <FileOutput>
Example:
java -cp hornetq-core.jar org.hornetq.core.journal.impl.ExportJournal /data/journal hornetq-data hq 2 10485760 /tmp/export.dmp
#File,JournalFileImpl: (hornetq-data-181323.hq id = 4, recordID = 4)
operation@AddRecord,id@1206247194,userRecordType@37,length@96,isUpdate@false,data@AAAAUGoAbQBzAC4AcQB1AGUAdQBlAC4AbQBzAGcAZAB1AHAAbABpAGMAYQB0AGUAXwBkAGkAdgBlAHIAdABfAG8AdQB0AGIAbwB1AG4AZABfADEAAAAACAAAAABHoHgp
operation@AddRecord,id@1206247203,userRecordType@37,length@96,isUpdate@false,data@AAAAUGoAbQBzAC4AcQB1AGUAdQBlAC4AbQBzAGcAZAB1AHAAbABpAGMAYQB0AGUAXwBkAGkAdgBlAHIAdABfAG8AdQB0AGIAbwB1AG4AZABfADEAAAAACAAAAABHoLLD
To import it:
Use: java -cp hornetq-core.jar org.hornetq.core.journal.impl.ImportJournal <JournalDirectory> <JournalPrefix> <FileExtension> <MinFiles> <FileSize> <FileOutput>
java -cp hornetq-core.jar:netty.jar org.hornetq.core.journal.impl.ImportJournal /data/journal hornetq-data hq 2 10485760 /tmp/export.dmp
BTW: we need netty.jar on the classpath as the journal is dependenging on HornetQBuffers which is using Netty classes
I will commit the two classes and write the doc for it early next week.