@Override public Object execute(ActionContext context) throws Exception { process(input, host, port, transactional); return null; }
/** * This is the normal constructor for programmatic access to the * <code>org.apache.activemq.artemis.core.persistence.impl.journal.XmlDataImporter</code> if the session passed * in uses auto-commit for sends. * <br> * If the session needs to be transactional then use the constructor which takes 2 sessions. * * @param inputStream the stream from which to read the XML for import * @param session used for sending messages, must use auto-commit for sends */ public void process(InputStream inputStream, ClientSession session) throws Exception { this.process(inputStream, session, null); }
@Override public Object execute(ActionContext context) throws Exception { process(input, host, port, transactional); return null; }
/** * This is the normal constructor for programmatic access to the * <code>org.apache.activemq.artemis.core.persistence.impl.journal.XmlDataImporter</code> if the session passed * in uses auto-commit for sends. * <br> * If the session needs to be transactional then use the constructor which takes 2 sessions. * * @param inputStream the stream from which to read the XML for import * @param session used for sending messages, must use auto-commit for sends */ public void process(InputStream inputStream, ClientSession session) throws Exception { this.process(inputStream, session, null); }
public void process(String inputFileName, String host, int port, boolean transactional) throws Exception { try (FileInputStream inputFile = new FileInputStream(inputFileName)) { this.process(inputFile, host, port, transactional); } }
public void process(String inputFile, String host, int port, boolean transactional) throws Exception { this.process(new FileInputStream(inputFile), host, port, transactional); }
public void process(InputStream inputStream, String host, int port, boolean transactional) throws Exception { HashMap<String, Object> connectionParams = new HashMap<>(); connectionParams.put(TransportConstants.HOST_PROP_NAME, host); connectionParams.put(TransportConstants.PORT_PROP_NAME, Integer.toString(port)); ServerLocator serverLocator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(NettyConnectorFactory.class.getName(), connectionParams)); ClientSessionFactory sf = serverLocator.createSessionFactory(); ClientSession session; ClientSession managementSession; if (user != null || password != null) { session = sf.createSession(user, password, false, !transactional, true, false, 0); managementSession = sf.createSession(user, password, false, true, true, false, 0); } else { session = sf.createSession(false, !transactional, true); managementSession = sf.createSession(false, true, true); } localSession = true; process(inputStream, session, managementSession); }
public void process(InputStream inputStream, String host, int port, boolean transactional) throws Exception { HashMap<String, Object> connectionParams = new HashMap<>(); connectionParams.put(TransportConstants.HOST_PROP_NAME, host); connectionParams.put(TransportConstants.PORT_PROP_NAME, Integer.toString(port)); ServerLocator serverLocator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(NettyConnectorFactory.class.getName(), connectionParams)); ClientSessionFactory sf = serverLocator.createSessionFactory(); ClientSession session; ClientSession managementSession; if (user != null || password != null) { session = sf.createSession(user, password, false, !transactional, true, false, 0); managementSession = sf.createSession(user, password, false, true, true, false, 0); } else { session = sf.createSession(false, !transactional, true); managementSession = sf.createSession(false, true, true); } localSession = true; process(inputStream, session, managementSession); }
@Override protected void executeRuntimeStep(OperationContext context, ModelNode operation) throws OperationFailedException { if (context.getRunningMode() != NORMAL) { throw MessagingLogger.ROOT_LOGGER.managementOperationAllowedOnlyInRunningMode(OPERATION_NAME, NORMAL); } checkAllowedOnJournal(context, OPERATION_NAME); String file = FILE.resolveModelAttribute(context, operation).asString(); boolean legacyPrefixes = LEGACY_PREFIXES.resolveModelAttribute(context, operation).asBoolean(); final XmlDataImporter importer = new XmlDataImporter(); importer.legacyPrefixes = legacyPrefixes; TransportConfiguration transportConfiguration = createInVMTransportConfiguration(context); try ( InputStream is = new FileInputStream(new File(file)); ServerLocator serverLocator = ActiveMQClient.createServerLocator(false, transportConfiguration); ClientSessionFactory sf = serverLocator.createSessionFactory() ) { ClientSession session = sf.createSession(); importer.process(is, session); } catch (Exception e) { throw new OperationFailedException(e); } }
@Override protected void executeRuntimeStep(OperationContext context, ModelNode operation) throws OperationFailedException { if (context.getRunningMode() != NORMAL) { throw MessagingLogger.ROOT_LOGGER.managementOperationAllowedOnlyInRunningMode(OPERATION_NAME, NORMAL); } checkAllowedOnJournal(context, OPERATION_NAME); String file = FILE.resolveModelAttribute(context, operation).asString(); boolean legacyPrefixes = LEGACY_PREFIXES.resolveModelAttribute(context, operation).asBoolean(); final XmlDataImporter importer = new XmlDataImporter(); importer.legacyPrefixes = legacyPrefixes; TransportConfiguration transportConfiguration = createInVMTransportConfiguration(context); try ( InputStream is = new FileInputStream(new File(file)); ServerLocator serverLocator = ActiveMQClient.createServerLocator(false, transportConfiguration); ClientSessionFactory sf = serverLocator.createSessionFactory() ) { ClientSession session = sf.createSession(); importer.process(is, session); } catch (Exception e) { throw new OperationFailedException(e); } }
xmlDataImporter.validate(xmlInputStream); xmlInputStream.reset(); xmlDataImporter.process(xmlInputStream, session); session.close();
xmlDataImporter.validate(xmlInputStream); xmlInputStream.reset(); xmlDataImporter.process(xmlInputStream, session); ClientConsumer consumer = session.createConsumer(QUEUE_NAME); session.start();
xmlDataImporter.validate(xmlInputStream); xmlInputStream.reset(); xmlDataImporter.process(xmlInputStream, session, managementSession);
xmlDataImporter.validate(xmlInputStream); xmlInputStream.reset(); xmlDataImporter.process(xmlInputStream, session); ClientConsumer consumer = session.createConsumer(QUEUE_NAME); session.start();
xmlDataImporter.validate(xmlInputStream); xmlInputStream.reset(); xmlDataImporter.process(xmlInputStream, session, managementSession); ClientConsumer consumer = session.createConsumer(QUEUE_NAME); session.start();
xmlDataImporter.validate(xmlInputStream); xmlInputStream.reset(); xmlDataImporter.process(xmlInputStream, session);
xmlDataImporter.validate(xmlInputStream); xmlInputStream.reset(); xmlDataImporter.process(xmlInputStream, session); ClientConsumer consumer = session.createConsumer(QUEUE_NAME); session.start();
xmlDataImporter.validate(xmlInputStream); xmlInputStream.reset(); xmlDataImporter.process(xmlInputStream, session); consumer = session.createConsumer("myQueue1"); session.start();
xmlDataImporter.validate(xmlInputStream); xmlInputStream.reset(); xmlDataImporter.process(xmlInputStream, session, managementSession); ClientConsumer consumer = session.createConsumer(QUEUE_NAME); session.start();
xmlDataImporter.validate(xmlInputStream); xmlInputStream.reset(); xmlDataImporter.process(xmlInputStream, session);