public static void main(String[]args) throws Exception { BrokerService brokerService = new BrokerService(); brokerService.addConnector( "tcp://0.0.0.0:61616?trace=" + TRANSPORT_TRACE + "&transport.wireFormat.maxFrameSize=104857600"); brokerService.setPersistent(false); brokerService.setUseJmx(false); brokerService.setAdvisorySupport(false); brokerService.start(); brokerService.waitUntilStopped(); } }
BrokerService broker = new BrokerService(); // configure the broker broker.setBrokerName("localhost"); broker.setUseJmx(false); broker.start();
@Bean(initMethod = "start", destroyMethod = "stop") @ConditionalOnProperty(prefix = "todo.jms", value = "broker", havingValue = "enabled", matchIfMissing = true) public BrokerService messageBroker() { try { BrokerService messageBroker = BrokerFactory.createBroker(String.format("broker:tcp://%s:%s", brokerHost, brokerPort)); messageBroker.setPersistent(false); messageBroker.setUseJmx(false); return messageBroker; } catch (Exception e) { throw new BeanCreationException("Failed to create embedded message broker", e); } }
@Override public void start(ILifecycleProgressMonitor monitor) throws SiteWhereException { try { getBrokerService().setBrokerName(getBrokerName()); TransportConnector connector = new TransportConnector(); connector.setUri(new URI(getTransportUri())); getBrokerService().addConnector(connector); getBrokerService().setUseShutdownHook(false); getBrokerService().setUseJmx(false); getBrokerService().start(); startConsumers(); } catch (Exception e) { throw new SiteWhereException("Error starting ActiveMQ inbound event receiver.", e); } }
/** * Create an embedded ActiveMQ broker using defaults * * The defaults are: * - the broker name is 'embedded-broker' * - JMX is disabled * - Persistence is disabled */ public EmbeddedActiveMQBroker() { brokerService = new BrokerService(); brokerService.setUseJmx(false); brokerService.setUseShutdownHook(false); brokerService.setPersistent(false); brokerService.setBrokerName("embedded-broker"); }
private void startActiveMqBroker() throws Exception { this.activeMQBroker = new BrokerService(); this.activeMQBroker.addConnector("stomp://localhost:" + this.port); this.activeMQBroker.setStartAsync(false); this.activeMQBroker.setPersistent(false); this.activeMQBroker.setUseJmx(false); this.activeMQBroker.getSystemUsage().getMemoryUsage().setLimit(1024 * 1024 * 5); this.activeMQBroker.getSystemUsage().getTempUsage().setLimit(1024 * 1024 * 5); this.activeMQBroker.start(); }
TransportConnector connector = new TransportConnector(); connector.setUri(new URI(getTransportUri())); brokerService.addConnector(connector); brokerService.setDataDirectory(getDataDirectory()); brokerService.setUseShutdownHook(false); brokerService.setUseJmx(false); brokerService.start(); startConsumers(); } catch (Exception e) {
protected BrokerService createBroker(String name, boolean deleteMessagesOnStartup, Map<String, Integer> portMap) throws Exception { BrokerService brokerService = new BrokerService(); brokerService.setBrokerName(name); brokerService.setDeleteAllMessagesOnStartup(deleteMessagesOnStartup); brokerService.setUseJmx(true); brokerService.getManagementContext().setCreateConnector(false); brokerService.setDataDirectory(DATA_PARENT_DIR + File.separator + "data" + File.separator + name); brokerService.setPersistent(false); brokerService.setSchedulerSupport(false); brokerService.setAdvisorySupport(false); ArrayList<BrokerPlugin> plugins = new ArrayList<BrokerPlugin>(); BrokerPlugin authenticationPlugin = configureAuthentication(); if (authenticationPlugin != null) { plugins.add(authenticationPlugin); } if (!plugins.isEmpty()) { brokerService.setPlugins(plugins.toArray(new BrokerPlugin[0])); } addAdditionalConnectors(brokerService, portMap); return brokerService; }
@Before public void setUp() throws Exception { brokerService = new BrokerService(); brokerService.setAdvisorySupport(true); brokerService.setPersistent(false); brokerService.setUseJmx(false); brokerService.start(); }
@Autowired public ActiveMqMessagingService(DaemonThreadStatsCollector daemonThreadStatsCollector) throws Exception { this.daemonThreadStatsCollector = daemonThreadStatsCollector; SystemEnvironment systemEnvironment = new SystemEnvironment(); broker = new BrokerService(); broker.setBrokerName(BROKER_NAME); broker.setPersistent(false); broker.setUseJmx(systemEnvironment.getActivemqUseJmx()); broker.getManagementContext().setConnectorPort(systemEnvironment.getActivemqConnectorPort()); broker.start(); factory = new ActiveMQConnectionFactory(BROKER_URL); factory.getPrefetchPolicy().setQueuePrefetch(systemEnvironment.getActivemqQueuePrefetch()); factory.setCopyMessageOnSend(false); connection = (ActiveMQConnection) factory.createConnection(); connection.start(); }
@Before public void setUp() throws Exception { brokerService = new BrokerService(); brokerService.setPersistent(false); brokerService.setUseJmx(true); String connectionUri = brokerService.addConnector("tcp://localhost:0").getPublishableConnectString(); brokerService.start(); brokerService.waitUntilStarted(); ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(connectionUri); final Connection conn = connectionFactory.createConnection(); try { conn.start(); final Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE); final Destination queue = session.createQueue(testQueueName); final Message toSend = session.createMessage(); toSend.setStringProperty("foo", "bar"); final MessageProducer producer = session.createProducer(queue); producer.send(queue, toSend); } finally { conn.close(); } }
@Before public void setUp() throws Exception { logger.debug("Setting up before '" + this.testName.getMethodName() + "'"); int port = SocketUtils.findAvailableTcpPort(61613); this.activeMQBroker = new BrokerService(); this.activeMQBroker.addConnector("stomp://127.0.0.1:" + port); this.activeMQBroker.setStartAsync(false); this.activeMQBroker.setPersistent(false); this.activeMQBroker.setUseJmx(false); this.activeMQBroker.getSystemUsage().getMemoryUsage().setLimit(1024 * 1024 * 5); this.activeMQBroker.getSystemUsage().getTempUsage().setLimit(1024 * 1024 * 5); this.activeMQBroker.start(); ThreadPoolTaskScheduler taskScheduler = new ThreadPoolTaskScheduler(); taskScheduler.afterPropertiesSet(); this.client = new ReactorNettyTcpStompClient("127.0.0.1", port); this.client.setMessageConverter(new StringMessageConverter()); this.client.setTaskScheduler(taskScheduler); }
public void start() { broker = new BrokerService(); try { broker.setUseJmx(false); broker.setPersistent(false); transportConnector = broker.addConnector(connectorUrl); broker.start(true); broker.waitUntilStarted(); } catch (Exception e) { throw new RuntimeException(e); } }
public void brokenBrokerTest() throws Exception { BrokerService broker = new BrokerService(); broker.setPersistent(false); broker.setUseJmx(false); broker.setTransportConnectorURIs(new String[]{"tcp://localhost:61623"}); broker.setDeleteAllMessagesOnStartup(true); broker.start();
@BeforeClass public static void setup() throws Exception { int port = SocketUtils.findAvailableTcpPort(61613); activeMQBroker = new BrokerService(); activeMQBroker.addConnector("stomp://127.0.0.1:" + port); activeMQBroker.setPersistent(false); activeMQBroker.setUseJmx(false); activeMQBroker.getSystemUsage().getMemoryUsage().setLimit(1024 * 1024 * 5); activeMQBroker.getSystemUsage().getTempUsage().setLimit(1024 * 1024 * 5); activeMQBroker.start(); stompClient = new ReactorNettyTcpStompClient("127.0.0.1", port); stompClient.setMessageConverter(new PassThruMessageConverter()); ThreadPoolTaskScheduler taskScheduler = new ThreadPoolTaskScheduler(); taskScheduler.afterPropertiesSet(); stompClient.setTaskScheduler(taskScheduler); stompClient.setReceiptTimeLimit(5000); }
BrokerService broker = new BrokerService(); broker.setUseJmx(true); broker.addConnector("tcp://localhost:61616"); broker.start();
public void start(String hostname, int port) throws Exception{ broker = new BrokerService(); broker.setUseJmx(false); broker.addConnector("tcp://" + hostname + ":" + port); broker.addConnector("stomp://"+hostname+":"+(port+2)); broker.start(); }
private static BrokerService initBroker(String name) throws Exception { BrokerService broker = new BrokerService(); broker.setBrokerName(name); broker.setPersistent(false); broker.setUseJmx(false); broker.setUseShutdownHook(false); broker.addConnector(BrokerConnectorsConfig.openWireConnectorURL); broker.addConnector(BrokerConnectorsConfig.stompConnectorURL); broker.addConnector(BrokerConnectorsConfig.wsConnectorURL); return broker; }
@Override public void initialize() throws ConnectorDataTransmissionException { this.broker = new BrokerService(); this.broker.setUseJmx(true); try { this.broker.addConnector("tcp://localhost:" + this.port); this.broker.start(); super.initialize(); // Cannot be avoided as the broker throws Exception. } catch (final Exception e) { // NOCS, NOPMD throw new ConnectorDataTransmissionException(e.getMessage(), e); } }
public static void startBroker(String url) { try { stopBroker(); broker = new BrokerService(); broker.setAdvisorySupport(true); broker.setPersistent(false); broker.setPopulateJMSXUserID(true); broker.setUseJmx(false); broker.addConnector(url); broker.start(); } catch (Exception e) { System.err.println("Error start broker: " + e); } }