/** * Create a default EmbeddedJMSResource with the specified server id */ public EmbeddedJMSResource(int serverId) { this.serverId = serverId; Map<String, Object> props = new HashMap<>(); props.put(TransportConstants.SERVER_ID_PROP_NAME, serverId); configuration = new ConfigurationImpl().setName(SERVER_NAME + "-" + serverId).setPersistenceEnabled(false).setSecurityEnabled(false).addAcceptorConfiguration(new TransportConfiguration(InVMAcceptorFactory.class.getName(), props)); jmsConfiguration = new JMSConfigurationImpl(); init(); }
/** * @param queues * @param topics * @param domain */ protected void newConfig(final ArrayList<JMSQueueConfiguration> queues, final ArrayList<TopicConfiguration> topics, String domain) { setQueueConfigurations(queues).setTopicConfigurations(topics).setDomain(domain); } }
/** * Create a default EmbeddedJMSResource with the specified server id */ public EmbeddedJMSResource(int serverId) { this.serverId = serverId; Map<String, Object> props = new HashMap<>(); props.put(TransportConstants.SERVER_ID_PROP_NAME, serverId); configuration = new ConfigurationImpl().setName(SERVER_NAME + "-" + serverId).setPersistenceEnabled(false).setSecurityEnabled(false).addAcceptorConfiguration(new TransportConfiguration(InVMAcceptorFactory.class.getName(), props)); jmsConfiguration = new JMSConfigurationImpl(); init(); }
/** * Create a default EmbeddedJMSResource */ public EmbeddedJMSResource(boolean useNetty) { try { configuration = new ConfigurationImpl().setName(SERVER_NAME).setPersistenceEnabled(false).setSecurityEnabled(false).addAcceptorConfiguration("invm", "vm://0"); if (useNetty) { configuration.addAcceptorConfiguration("netty", DefaultConnectionProperties.DEFAULT_BROKER_BIND_URL); } jmsConfiguration = new JMSConfigurationImpl(); init(); } catch (Exception e) { throw new RuntimeException(e); } }
/** * Create a default EmbeddedJMSResource */ public EmbeddedJMSResource(boolean useNetty) { try { configuration = new ConfigurationImpl().setName(SERVER_NAME).setPersistenceEnabled(false).setSecurityEnabled(false).addAcceptorConfiguration("invm", "vm://0"); if (useNetty) { configuration.addAcceptorConfiguration("netty", DefaultConnectionProperties.DEFAULT_BROKER_BIND_URL); } jmsConfiguration = new JMSConfigurationImpl(); init(); } catch (Exception e) { throw new RuntimeException(e); } }
@Given("^Start Event Broker$") public void start() { if (NO_EMBEDDED_SERVERS) { return; } System.setProperty(SystemSettingKey.EVENT_BUS_URL.key(), "amqp://127.0.0.1:5672"); database.setup(); logger.info("Starting new instance of Event Broker"); try { //start Artemis embedded Configuration configuration = new ConfigurationImpl(); configuration.setPersistenceEnabled(false); configuration.setJournalDirectory(DEFAULT_DATA_DIRECTORY); configuration.setSecurityEnabled(false); configuration.addAcceptorConfiguration("amqp", "tcp://127.0.0.1:5672?protocols=AMQP"); configuration.addConnectorConfiguration("connector", "tcp://127.0.0.1:5672"); JMSConfiguration jmsConfig = new JMSConfigurationImpl(); ConnectionFactoryConfiguration cfConfig = new ConnectionFactoryConfigurationImpl().setName("cf").setConnectorNames(Arrays.asList("connector")).setBindings("cf"); jmsConfig.getConnectionFactoryConfigurations().add(cfConfig); jmsServer = new EmbeddedJMS().setConfiguration(configuration).setJmsConfiguration(jmsConfig).start(); if (EXTRA_STARTUP_DELAY > 0) { Thread.sleep(Duration.ofSeconds(EXTRA_STARTUP_DELAY).toMillis()); } } catch (RuntimeException e) { throw e; } catch (Exception e) { logger.error("Failed to start Event Broker", e); } }
@PostConstruct public void start() throws Exception { String port = Systems.getEnvVarOrSystemProperty("AMQ_PORT", "AMQ_PORT", "61616"); HashMap<String, Object> configMap = new HashMap<>(); configMap.put("host", "0.0.0.0"); configMap.put("port", port); TransportConfiguration transportConfiguration = new TransportConfiguration(NettyAcceptorFactory.class.getName(), configMap, "artemis"); Configuration configuration = new ConfigurationImpl().setJournalDirectory(DATA_ROOT + "journal-directory"); if (isPersistent()) { configuration.setBindingsDirectory(DATA_ROOT + "bindings"); configuration.setLargeMessagesDirectory(DATA_ROOT + "largemessages"); configuration.setPagingDirectory(DATA_ROOT + "paging"); configuration.setCreateJournalDir(true); configuration.setCreateBindingsDir(true); waitForVolume(); }else{ configuration.setPersistenceEnabled(false); } configuration.setSecurityEnabled(false); configuration.addAcceptorConfiguration(transportConfiguration); JMSConfiguration jmsConfig = new JMSConfigurationImpl(); broker = new EmbeddedJMS(); broker.setConfiguration(configuration); broker.setJmsConfiguration(jmsConfig); broker.start(); LOG.info("Artemis Message Broker initialized and running ..."); }
/** * Creates and configures a new instance. * * @param dataDirectory root directory where persistent messages are stored * @param useLibAio true to use libaio, false to use NIO. * @param injector Google Guice injector. Used to inject dependency members into commands if needed. * @param queueConfigs vararg of QueueConfig> instances. */ public Async(String dataDirectory, boolean useLibAio, Injector injector, QueueConfig... queueConfigs) { try { this.injector = injector; jmsServer = new EmbeddedJMS(); config = new ConfigurationImpl(); jmsConfig = new JMSConfigurationImpl(); Collections.addAll(queueConfigsList, queueConfigs); configureLocations(dataDirectory); configureAcceptor(); configureConnectionFactory(); configurePaging(); configureQueues(queueConfigs); configureJournal(useLibAio); config.setThreadPoolMaxSize(-1); config.setGracefulShutdownEnabled(true); config.setScheduledThreadPoolMaxSize(10); } catch (AsyncException e) { throw e; } catch (Exception e) { throw new AsyncException("Failed to start EmbeddedJMS", e); } }
/** * Creates and configures a new instance. * * @param dataDirectory root directory where persistent messages are stored * @param useLibAio true to use libaio, false to use NIO. * @param injector Google Guice injector. Used to inject dependency members into commands if needed. * @param queueConfigs vararg of QueueConfig> instances. */ public Async(String dataDirectory, boolean useLibAio, Injector injector, QueueConfig... queueConfigs) { try { this.injector = injector; jmsServer = new EmbeddedJMS(); config = new ConfigurationImpl(); jmsConfig = new JMSConfigurationImpl(); Collections.addAll(queueConfigsList, queueConfigs); configureLocations(dataDirectory); configureAcceptor(); configureConnectionFactory(); configurePaging(); configureQueues(queueConfigs); configureJournal(useLibAio); config.setThreadPoolMaxSize(-1); config.setGracefulShutdownEnabled(true); config.setScheduledThreadPoolMaxSize(10); } catch (AsyncException e) { throw e; } catch (Exception e) { throw new AsyncException("Failed to start EmbeddedJMS", e); } }
/** * @throws Exception */ private void setupServer2() throws Exception { Configuration configuration = createConfigServer(2, 1); JMSConfigurationImpl jmsconfig = new JMSConfigurationImpl(); mBeanServer2 = MBeanServerFactory.createMBeanServer(); server2 = addServer(ActiveMQServers.newActiveMQServer(configuration, mBeanServer2, enablePersistence())); jmsServer2 = new JMSServerManagerImpl(server2, jmsconfig); context2 = new InVMNamingContext(); jmsServer2.setRegistry(new JndiBindingRegistry(context2)); }
/** * @throws Exception */ private void setupServer1() throws Exception { Configuration configuration = createConfigServer(1, 2); JMSConfigurationImpl jmsconfig = new JMSConfigurationImpl(); mBeanServer1 = MBeanServerFactory.createMBeanServer(); server1 = addServer(ActiveMQServers.newActiveMQServer(configuration, mBeanServer1, enablePersistence())); jmsServer1 = new JMSServerManagerImpl(server1, jmsconfig); context1 = new InVMNamingContext(); jmsServer1.setRegistry(new JndiBindingRegistry(context1)); }
JMSConfiguration jmsConfiguration = new JMSConfigurationImpl(); TransportConfiguration connectorConfig = new TransportConfiguration(InVMConnectorFactory.class.getName()); List<TransportConfiguration> transportConfigs = new ArrayList<>();