Class 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 ActionAbstract
    Read XML output from org.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 StAX javax.xml.stream.XMLStreamReader for speed and simplicity.
    • Field Detail

      • host

        public java.lang.String host
      • port

        public int port
      • transactional

        public boolean transactional
      • user

        public java.lang.String user
      • password

        public java.lang.String password
      • input

        public java.lang.String input
      • sort

        public boolean sort
      • legacyPrefixes

        public boolean legacyPrefixes
    • Constructor Detail

      • XmlDataImporter

        public XmlDataImporter()
    • 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)
      • 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.Exception
        This is the normal constructor for programmatic access to the org.apache.activemq.artemis.core.persistence.impl.journal.XmlDataImporter if 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 import
        session - 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.Exception
        This 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 import
        session - used for sending messages, doesn't need to auto-commit sends
        managementSession - 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