We have recently migrated from JBoss EAP to Wildfly and we are using HornetQ in EAP. As wildfly has ActiveMQ, we needed to migrate from HornetQ to ActiveMQ. I have struggled for few days on how to migrate existing messages from HornetQ to ActiveMQ, so I thought it will be good idea to share it will everyone who are facing same situation.
Follow below steps to export existing messages from HornetQ journal.
4. Edit ExportMessages.bat file and paste below content into it and save.
java -cp ./hornetq-server-2.3.0.CR1.jar;./hornetq-core-client-2.3.0.CR1.jar;./hornetq-commons-2.3.0.CR1.jar;./hornetq-journal-2.3.0.CR1.jar;./hornetq-jms-client-2.3.0.CR1.jar;./hornetq-jms-server-2.3.0.CR1;./jboss-logging-3.3.0.Final.jar;./netty-3.2.0.Final.jar; org.hornetq.core.persistence.impl.journal.XmlDataExporter E:\Product\Hornetq\bindings E:\Product\Hornetq\journal null E:\Product\Hornetq\large-messages > journal-export.xml
5. Highlighted above are HornetQ bindings, journals, paging and large messages folders respectively.
Before executing this step make sure your Queue in HornetQ contains any message otherwise you will not be able to verify if it is really imported into ActiveMQ or not.
6. Execute ExportMessages.bat file.
7. It will create journal-export.xml file in same folder with all Queue and its messages detail in that.
8. Run wildfly server and open command prompt at wildfly_home/bin.
9. Run jboss-cli.bat –gui
10. Above command will open GUI for jboss command line interface.
11. There will be cmd> textbox in upper part of that UI.
12. Paste below command into that text box and press “Submit” button beside.
/subsystem=messaging-activemq/server=default:import-journal(file= D:\\ExportUtility\\journal-export.xml)
13. It will below message on output tab below.
/subsystem=messaging-activemq/server=default:import-journal(file= D:\\ExportUtility\\journal-export.xml)
{"outcome" => "success"}
14. If it fails due to any reason then it will failure message as below.
/subsystem=messaging-activemq/server=default:import-journal(file=C:\\Users\\bodap\\Desktop\\journal-export.xml)
{
"outcome" => "failed",
"failure-description" => "java.lang.String cannot be cast to java.lang.Number",
"rolled-back" => true
}
15. To verify if your message is got imported into ActiveMQ, please visit admin console (http://localhost:9990/console) of Wildfly and check if given Queue contains messages you imported.
Let me know your feedback and suggestions so I can improve it will additional information.
Follow below steps to export existing messages from HornetQ journal.
- Copy below jar files from JBOSS_HOME\modules\system\layers\base\org\hornetq\main to any folder. i.e. D:\ExportUtility
- hornetq-server-2.3.0.CR1.jar;
- hornetq-core-client-2.3.0.CR1.jar;
- hornetq-commons-2.3.0.CR1.jar;
- hornetq-journal-2.3.0.CR1.jar;
- hornetq-jms-client-2.3.0.CR1.jar;
- hornetq-jms-server-2.3.0.CR1;
- jboss-logging-3.3.0.Final.jar;
- netty-3.2.0.Final.jar
3. Create D:\ExportUtility\ExportMessages.bat.
4. Edit ExportMessages.bat file and paste below content into it and save.
java -cp ./hornetq-server-2.3.0.CR1.jar;./hornetq-core-client-2.3.0.CR1.jar;./hornetq-commons-2.3.0.CR1.jar;./hornetq-journal-2.3.0.CR1.jar;./hornetq-jms-client-2.3.0.CR1.jar;./hornetq-jms-server-2.3.0.CR1;./jboss-logging-3.3.0.Final.jar;./netty-3.2.0.Final.jar; org.hornetq.core.persistence.impl.journal.XmlDataExporter E:\Product\Hornetq\bindings E:\Product\Hornetq\journal null E:\Product\Hornetq\large-messages > journal-export.xml
5. Highlighted above are HornetQ bindings, journals, paging and large messages folders respectively.
Before executing this step make sure your Queue in HornetQ contains any message otherwise you will not be able to verify if it is really imported into ActiveMQ or not.
6. Execute ExportMessages.bat file.
7. It will create journal-export.xml file in same folder with all Queue and its messages detail in that.
8. Run wildfly server and open command prompt at wildfly_home/bin.
9. Run jboss-cli.bat –gui
10. Above command will open GUI for jboss command line interface.
11. There will be cmd> textbox in upper part of that UI.
12. Paste below command into that text box and press “Submit” button beside.
/subsystem=messaging-activemq/server=default:import-journal(file= D:\\ExportUtility\\journal-export.xml)
13. It will below message on output tab below.
/subsystem=messaging-activemq/server=default:import-journal(file= D:\\ExportUtility\\journal-export.xml)
{"outcome" => "success"}
14. If it fails due to any reason then it will failure message as below.
/subsystem=messaging-activemq/server=default:import-journal(file=C:\\Users\\bodap\\Desktop\\journal-export.xml)
{
"outcome" => "failed",
"failure-description" => "java.lang.String cannot be cast to java.lang.Number",
"rolled-back" => true
}
15. To verify if your message is got imported into ActiveMQ, please visit admin console (http://localhost:9990/console) of Wildfly and check if given Queue contains messages you imported.
Let me know your feedback and suggestions so I can improve it will additional information.