Package org.apache.activemq.broker

Examples of org.apache.activemq.broker.BrokerService


        ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("tcp://localhost:61616");
        return factory.createConnection();
    }

    private void startBroker() throws Exception {
        broker = new BrokerService();
        broker.setDeleteAllMessagesOnStartup(true);
        broker.setPersistent(true);
        broker.setUseJmx(true);
        broker.addConnector("tcp://localhost:61616").setName("Default");
          
View Full Code Here


    protected NetworkConnector bridgeBrokers(String localBrokerName, String remoteBrokerName) throws Exception {
        return bridgeBrokers(localBrokerName, remoteBrokerName, false, 1);
    }

    protected void bridgeBrokers(String localBrokerName, String remoteBrokerName, boolean dynamicOnly) throws Exception {
        BrokerService localBroker = brokers.get(localBrokerName).broker;
        BrokerService remoteBroker = brokers.get(remoteBrokerName).broker;

        bridgeBrokers(localBroker, remoteBroker, dynamicOnly, 1);
    }
View Full Code Here

        bridgeBrokers(localBroker, remoteBroker, dynamicOnly, 1);
    }

    protected NetworkConnector bridgeBrokers(String localBrokerName, String remoteBrokerName, boolean dynamicOnly, int networkTTL) throws Exception {
        BrokerService localBroker = brokers.get(localBrokerName).broker;
        BrokerService remoteBroker = brokers.get(remoteBrokerName).broker;

        return bridgeBrokers(localBroker, remoteBroker, dynamicOnly, networkTTL);
    }
View Full Code Here

    }

    protected void bridgeAllBrokers(String groupName) throws Exception {
        Collection<BrokerItem> brokerList = brokers.values();
        for (Iterator<BrokerItem> i = brokerList.iterator(); i.hasNext();) {
            BrokerService broker = i.next().broker;
            List transportConnectors = broker.getTransportConnectors();

            if (transportConnectors.isEmpty()) {
                broker.addConnector(new URI(AUTO_ASSIGN_TRANSPORT));
                transportConnectors = broker.getTransportConnectors();
            }

            TransportConnector transport = (TransportConnector)transportConnectors.get(0);
            transport.setDiscoveryUri(new URI("multicast://default?group=" + groupName));
            broker.addNetworkConnector("multicast://default?group=" + groupName);
        }

        // Multicasting may take longer to setup
        maxSetupTime = 8000;
    }
View Full Code Here

    }

    protected void startAllBrokers() throws Exception {
        Collection<BrokerItem> brokerList = brokers.values();
        for (Iterator<BrokerItem> i = brokerList.iterator(); i.hasNext();) {
            BrokerService broker = i.next().broker;
            broker.start();
        }

        Thread.sleep(maxSetupTime);
    }
View Full Code Here

        Thread.sleep(maxSetupTime);
    }

    protected BrokerService createBroker(String brokerName) throws Exception {
        BrokerService broker = new BrokerService();
        broker.setBrokerName(brokerName);
        brokers.put(brokerName, new BrokerItem(broker));

        return broker;
    }
View Full Code Here

        return broker;
    }

    protected BrokerService createBroker(URI brokerUri) throws Exception {
        BrokerService broker = BrokerFactory.createBroker(brokerUri);
        brokers.put(broker.getBrokerName(), new BrokerItem(broker));

        return broker;
    }
View Full Code Here

    protected BrokerService createBroker(Resource configFile) throws Exception {
        BrokerFactoryBean brokerFactory = new BrokerFactoryBean(configFile);
        brokerFactory.afterPropertiesSet();

        BrokerService broker = brokerFactory.getBroker();
        brokers.put(broker.getBrokerName(), new BrokerItem(broker));

        return broker;
    }
View Full Code Here

    public static void main(String[] args) {
        junit.textui.TestRunner.run(suite());
    }

    protected BrokerService createBroker() throws Exception {
        BrokerService service = new BrokerService();
        service.setDeleteAllMessagesOnStartup(true);
        AMQPersistenceAdapter pa = new AMQPersistenceAdapter();
       
        JPAReferenceStoreAdapter rfa = new JPAReferenceStoreAdapter();
        Properties props = new Properties();
        props.setProperty("openjpa.ConnectionDriverName", "org.apache.derby.jdbc.EmbeddedDriver");
        props.setProperty("openjpa.ConnectionURL", "jdbc:derby:activemq-data/derby;create=true");
        props.setProperty("openjpa.jdbc.SynchronizeMappings", "buildSchema");
//        props.setProperty("openjpa.Log", "DefaultLevel=WARN,SQL=TRACE");
        rfa.setEntityManagerProperties(props);
        pa.setReferenceStoreAdapter(rfa);       
       
        service.setPersistenceAdapter(pa);
        return service;
    }
View Full Code Here

        service.setPersistenceAdapter(pa);
        return service;
    }
   
    protected BrokerService createRestartedBroker() throws Exception {
        BrokerService service = new BrokerService();
        AMQPersistenceAdapter pa = new AMQPersistenceAdapter();
       
        JPAReferenceStoreAdapter rfa = new JPAReferenceStoreAdapter();
        Properties props = new Properties();
        props.setProperty("openjpa.ConnectionDriverName", "org.apache.derby.jdbc.EmbeddedDriver");
        props.setProperty("openjpa.ConnectionURL", "jdbc:derby:activemq-data/derby;create=true");
        props.setProperty("openjpa.jdbc.SynchronizeMappings", "buildSchema");
//        props.setProperty("openjpa.Log", "DefaultLevel=WARN,SQL=TRACE");
        rfa.setEntityManagerProperties(props);
        pa.setReferenceStoreAdapter(rfa);       
       
        service.setPersistenceAdapter(pa);
        return service;
    }
View Full Code Here

TOP

Related Classes of org.apache.activemq.broker.BrokerService

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.