Java Code Examples for org.apache.activemq.broker.BrokerService#setPersistenceFactory()

The following examples show how to use org.apache.activemq.broker.BrokerService#setPersistenceFactory() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IgniteJmsStreamerTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/**
 * @throws Exception If failed.
 */
@SuppressWarnings("unchecked")
@Override public void beforeTest() throws Exception {
    grid().<Integer, String>getOrCreateCache(defaultCacheConfiguration());

    broker = new BrokerService();
    broker.setDeleteAllMessagesOnStartup(true);
    broker.setPersistent(false);
    broker.setPersistenceAdapter(null);
    broker.setPersistenceFactory(null);

    PolicyMap plcMap = new PolicyMap();
    PolicyEntry plc = new PolicyEntry();

    plc.setQueuePrefetch(1);

    broker.setDestinationPolicy(plcMap);
    broker.getDestinationPolicy().setDefaultEntry(plc);
    broker.setSchedulerSupport(false);

    broker.start(true);

    connFactory = new ActiveMQConnectionFactory(BrokerRegistry.getInstance().findFirst().getVmConnectorURI());
}
 
Example 2
Source File: SimpleDurableTopicTest.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
@Override
protected void configureBroker(BrokerService answer, String uri) throws Exception {
   LevelDBStoreFactory persistenceFactory = new LevelDBStoreFactory();
   answer.setPersistenceFactory(persistenceFactory);
   //answer.setDeleteAllMessagesOnStartup(true);
   answer.addConnector(uri);
   answer.setUseShutdownHook(false);
}
 
Example 3
Source File: IgniteMqttStreamerTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/**
 * @throws Exception If failed.
 */
@SuppressWarnings("unchecked")
@Override public void beforeTest() throws Exception {
    grid().<Integer, String>getOrCreateCache(defaultCacheConfiguration());

    // find an available local port
    try (ServerSocket ss = new ServerSocket(0)) {
        port = ss.getLocalPort();
    }

    // create the broker
    broker = new BrokerService();
    broker.setDeleteAllMessagesOnStartup(true);
    broker.setPersistent(false);
    broker.setPersistenceAdapter(null);
    broker.setPersistenceFactory(null);

    PolicyMap plcMap = new PolicyMap();
    PolicyEntry plc = new PolicyEntry();

    plc.setQueuePrefetch(1);

    broker.setDestinationPolicy(plcMap);
    broker.getDestinationPolicy().setDefaultEntry(plc);
    broker.setSchedulerSupport(false);

    // add the MQTT transport connector to the broker
    broker.addConnector("mqtt://localhost:" + port);
    broker.setStartAsync(false);
    broker.start(true);

    // create the broker URL
    brokerUrl = "tcp://localhost:" + port;

    // create the client and connect
    client = new MqttClient(brokerUrl, UUID.randomUUID().toString(), new MemoryPersistence());

    client.connect();

    // create mqtt streamer
    dataStreamer = grid().dataStreamer(DEFAULT_CACHE_NAME);

    streamer = createMqttStreamer(dataStreamer);
}