Class XmlDataImporter
- java.lang.Object
-
- org.apache.activemq.artemis.cli.commands.ActionAbstract
-
- org.apache.activemq.artemis.cli.commands.tools.xml.XmlDataImporter
-
- All Implemented Interfaces:
Action
@Command(name="imp", description="Import all message-data using an XML that could be interpreted by any system.") public final class XmlDataImporter extends ActionAbstractRead XML output fromorg.apache.activemq.artemis.core.persistence.impl.journal.XmlDataExporter, create a core session, and send the messages to a running instance of ActiveMQ Artemis. It uses the StAXjavax.xml.stream.XMLStreamReaderfor speed and simplicity.
-
-
Field Summary
Fields Modifier and Type Field Description java.lang.Stringhostjava.lang.StringinputbooleanlegacyPrefixesjava.lang.Stringpasswordintportbooleansortbooleantransactionaljava.lang.Stringuser-
Fields inherited from class org.apache.activemq.artemis.cli.commands.ActionAbstract
DEFAULT_BROKER_ACCEPTOR, DEFAULT_BROKER_URL, verbose
-
-
Constructor Summary
Constructors Constructor Description XmlDataImporter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectexecute(ActionContext context)java.lang.StringgetPassword()java.lang.StringgetUser()voidprocess(java.io.InputStream inputStream, java.lang.String host, int port, boolean transactional)voidprocess(java.io.InputStream inputStream, org.apache.activemq.artemis.api.core.client.ClientSession session)This is the normal constructor for programmatic access to theorg.apache.activemq.artemis.core.persistence.impl.journal.XmlDataImporterif the session passed in uses auto-commit for sends.voidprocess(java.io.InputStream inputStream, org.apache.activemq.artemis.api.core.client.ClientSession session, org.apache.activemq.artemis.api.core.client.ClientSession managementSession)This is the constructor to use if you wish to import all messages transactionally.voidprocess(java.lang.String inputFileName, java.lang.String host, int port, boolean transactional)voidsetPassword(java.lang.String password)voidsetUser(java.lang.String user)voidvalidate(java.io.InputStream inputStream)voidvalidate(java.lang.String fileName)-
Methods inherited from class org.apache.activemq.artemis.cli.commands.ActionAbstract
checkOptions, getActionContext, getBrokerConfiguration, getBrokerEtc, getBrokerHome, getBrokerInstance, getBrokerURIInstance, getBrokerURLInstance, isVerbose, setHomeValues
-
-
-
-
Method Detail
-
getPassword
public java.lang.String getPassword()
-
setPassword
public void setPassword(java.lang.String password)
-
getUser
public java.lang.String getUser()
-
setUser
public void setUser(java.lang.String user)
-
execute
public java.lang.Object execute(ActionContext context) throws java.lang.Exception
- Specified by:
executein interfaceAction- Overrides:
executein classActionAbstract- Throws:
java.lang.Exception
-
process
public void process(java.lang.String inputFileName, java.lang.String host, int port, boolean transactional) throws java.lang.Exception- Throws:
java.lang.Exception
-
process
public void process(java.io.InputStream inputStream, org.apache.activemq.artemis.api.core.client.ClientSession session) throws java.lang.ExceptionThis is the normal constructor for programmatic access to theorg.apache.activemq.artemis.core.persistence.impl.journal.XmlDataImporterif the session passed in uses auto-commit for sends.
If the session needs to be transactional then use the constructor which takes 2 sessions.- Parameters:
inputStream- the stream from which to read the XML for importsession- used for sending messages, must use auto-commit for sends- Throws:
java.lang.Exception
-
process
public void process(java.io.InputStream inputStream, org.apache.activemq.artemis.api.core.client.ClientSession session, org.apache.activemq.artemis.api.core.client.ClientSession managementSession) throws java.lang.ExceptionThis is the constructor to use if you wish to import all messages transactionally.
Pass in a session which doesn't use auto-commit for sends, and one that does (for management operations necessary during import).- Parameters:
inputStream- the stream from which to read the XML for importsession- used for sending messages, doesn't need to auto-commit sendsmanagementSession- used for management queries, must use auto-commit for sends- Throws:
java.lang.Exception
-
process
public void process(java.io.InputStream inputStream, java.lang.String host, int port, boolean transactional) throws java.lang.Exception- Throws:
java.lang.Exception
-
validate
public void validate(java.lang.String fileName) throws java.lang.Exception- Throws:
java.lang.Exception
-
validate
public void validate(java.io.InputStream inputStream) throws java.lang.Exception- Throws:
java.lang.Exception
-
-