Package org.apache.activemq.broker

Examples of org.apache.activemq.broker.BrokerService


* @version $Revision: 565003 $
*/
public class XATest extends TestCase {

    public void testXA() throws Exception {
        BrokerService broker = new BrokerService();
        broker.addConnector("tcp://localhost:61616");
        broker.start();

        String url = "tcp://localhost:61616";
        String qName = "MyQueue";
        int timeout = 5;
        DefaultXidFactory xidFactory = new DefaultXidFactory();
View Full Code Here


* @version $Revision$
*/
public class QuickJPAStoreRecoveryBrokerTest extends RecoveryBrokerTest {

    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

public class QuickJPAStoreLoadTester extends LoadTester {

    protected BrokerService createBroker() throws Exception {
        BrokerFactoryBean brokerFactory = new BrokerFactoryBean(new ClassPathResource("org/apache/activemq/broker/store/quickjpabroker.xml"));
        brokerFactory.afterPropertiesSet();
        BrokerService broker = brokerFactory.getBroker();
        broker.setDeleteAllMessagesOnStartup(true);
        return broker;
    }
View Full Code Here

     * Factory method to create a new broker
     *
     * @throws Exception
     */
    protected BrokerService createBroker() throws Exception {
        BrokerService answer = new BrokerService();
        answer.setPersistent(isPersistent());
        answer.addConnector(bindAddress);
        return answer;
    }
View Full Code Here

                ActiveMQConnection.DEFAULT_BROKER_URL);
        return cf;
    }

    protected BrokerService createBroker() throws Exception {
        BrokerService answer = new BrokerService();
        configureBroker(answer);
        answer.start();
        return answer;
    }
View Full Code Here

                ActiveMQConnection.DEFAULT_BROKER_URL);
        return cf;
    }

    protected BrokerService createBroker() throws Exception {
        BrokerService answer = new BrokerService();
        configureBroker(answer);
        answer.start();
        return answer;
    }
View Full Code Here

        connection2.close();
    }

    protected void assertCreateConnection(String uri) throws Exception {
        // Start up a broker with a tcp connector.
        BrokerService broker = new BrokerService();
        broker.setPersistent(false);
        TransportConnector connector = broker.addConnector(uri);
        broker.start();

        URI temp = new URI(uri);
        // URI connectURI = connector.getServer().getConnectURI();
        // TODO this sometimes fails when using the actual local host name
        URI currentURI = connector.getServer().getConnectURI();

        // sometimes the actual host name doesn't work in this test case
        // e.g. on OS X so lets use the original details but just use the actual
        // port
        URI connectURI = new URI(temp.getScheme(), temp.getUserInfo(), temp.getHost(), currentURI.getPort(),
                                 temp.getPath(), temp.getQuery(), temp.getFragment());

        LOG.info("connection URI is: " + connectURI);

        // This should create the connection.
        ActiveMQXAConnectionFactory cf = new ActiveMQXAConnectionFactory(connectURI);
        Connection connection = cf.createConnection();

        assertXAConnection(connection);

        assertNotNull(connection);
        connection.close();

        connection = cf.createXAConnection();

        assertXAConnection(connection);

        assertNotNull(connection);
        connection.close();

        broker.stop();
    }
View Full Code Here

        // trival session/producer pool
        final Session[] sessions = new Session[NUM_THREADS];
        final MessageProducer[] producers = new MessageProducer[NUM_THREADS];

        public void setUp() throws Exception {
            broker = new BrokerService();
            broker.setPersistent(false);
            broker.addConnector(BROKER_URL);
            broker.start();
           
            BlockingQueue<Runnable> queue = new ArrayBlockingQueue<Runnable>(10000);
View Full Code Here

        }.start();
        return done;
    }

    protected BrokerService createBroker() throws Exception {
        BrokerService service = new BrokerService();
        service.setPersistent(false);
        service.setUseJmx(false);

        // Setup a destination policy where it takes only 1 message at a time.
        PolicyMap policyMap = new PolicyMap();
        PolicyEntry policy = new PolicyEntry();
        policy.setMemoryLimit(1);
        policy.setPendingSubscriberPolicy(new VMPendingSubscriberMessageStoragePolicy());
        policy.setPendingQueuePolicy(new VMPendingQueueMessageStoragePolicy());
        policyMap.setDefaultEntry(policy);
        service.setDestinationPolicy(policyMap);

        connector = service.addConnector("tcp://localhost:0");
        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.