Search in sources :

Example 21 with MessageStoreConfig

use of org.apache.rocketmq.store.config.MessageStoreConfig in project rocketmq by apache.

the class BrokerControllerTest method testBrokerRestart.

/**
 * Tests if the controller can be properly stopped and started.
 *
 * @throws Exception If fails.
 */
@Test
public void testBrokerRestart() throws Exception {
    BrokerController brokerController = new BrokerController(new BrokerConfig(), new NettyServerConfig(), new NettyClientConfig(), new MessageStoreConfig());
    assertThat(brokerController.initialize());
    brokerController.start();
    brokerController.shutdown();
}
Also used : MessageStoreConfig(org.apache.rocketmq.store.config.MessageStoreConfig) BrokerConfig(org.apache.rocketmq.common.BrokerConfig) NettyClientConfig(org.apache.rocketmq.remoting.netty.NettyClientConfig) NettyServerConfig(org.apache.rocketmq.remoting.netty.NettyServerConfig) Test(org.junit.Test)

Example 22 with MessageStoreConfig

use of org.apache.rocketmq.store.config.MessageStoreConfig in project rocketmq by apache.

the class AppendCallbackTest method init.

@Before
public void init() throws Exception {
    MessageStoreConfig messageStoreConfig = new MessageStoreConfig();
    messageStoreConfig.setMapedFileSizeCommitLog(1024 * 8);
    messageStoreConfig.setMapedFileSizeConsumeQueue(1024 * 4);
    messageStoreConfig.setMaxHashSlotNum(100);
    messageStoreConfig.setMaxIndexNum(100 * 10);
    messageStoreConfig.setStorePathRootDir(System.getProperty("user.home") + File.separator + "unitteststore");
    messageStoreConfig.setStorePathCommitLog(System.getProperty("user.home") + File.separator + "unitteststore" + File.separator + "commitlog");
    // too much reference
    DefaultMessageStore messageStore = new DefaultMessageStore(messageStoreConfig, null, null, null);
    CommitLog commitLog = new CommitLog(messageStore);
    callback = commitLog.new DefaultAppendMessageCallback(1024);
}
Also used : MessageStoreConfig(org.apache.rocketmq.store.config.MessageStoreConfig) Before(org.junit.Before)

Example 23 with MessageStoreConfig

use of org.apache.rocketmq.store.config.MessageStoreConfig in project rocketmq by apache.

the class ConsumeQueueTest method gen.

protected DefaultMessageStore gen() throws Exception {
    MessageStoreConfig messageStoreConfig = buildStoreConfig(commitLogFileSize, cqFileSize, true, cqExtFileSize);
    BrokerConfig brokerConfig = new BrokerConfig();
    DefaultMessageStore master = new DefaultMessageStore(messageStoreConfig, new BrokerStatsManager(brokerConfig.getBrokerClusterName()), new MessageArrivingListener() {

        @Override
        public void arriving(String topic, int queueId, long logicOffset, long tagsCode, long msgStoreTime, byte[] filterBitMap, Map<String, String> properties) {
        }
    }, brokerConfig);
    assertThat(master.load()).isTrue();
    master.start();
    return master;
}
Also used : BrokerStatsManager(org.apache.rocketmq.store.stats.BrokerStatsManager) MessageStoreConfig(org.apache.rocketmq.store.config.MessageStoreConfig) BrokerConfig(org.apache.rocketmq.common.BrokerConfig)

Example 24 with MessageStoreConfig

use of org.apache.rocketmq.store.config.MessageStoreConfig in project rocketmq by apache.

the class DefaultMessageStoreShuwDownTest method buildMessageStore.

public DefaultMessageStore buildMessageStore() throws Exception {
    MessageStoreConfig messageStoreConfig = new MessageStoreConfig();
    messageStoreConfig.setMapedFileSizeCommitLog(1024 * 1024 * 10);
    messageStoreConfig.setMapedFileSizeConsumeQueue(1024 * 1024 * 10);
    messageStoreConfig.setMaxHashSlotNum(10000);
    messageStoreConfig.setMaxIndexNum(100 * 100);
    messageStoreConfig.setFlushDiskType(FlushDiskType.SYNC_FLUSH);
    return new DefaultMessageStore(messageStoreConfig, new BrokerStatsManager("simpleTest"), null, new BrokerConfig());
}
Also used : BrokerStatsManager(org.apache.rocketmq.store.stats.BrokerStatsManager) MessageStoreConfig(org.apache.rocketmq.store.config.MessageStoreConfig) BrokerConfig(org.apache.rocketmq.common.BrokerConfig)

Example 25 with MessageStoreConfig

use of org.apache.rocketmq.store.config.MessageStoreConfig in project rocketmq by apache.

the class DefaultMessageStoreTest method destory.

@After
public void destory() {
    messageStore.shutdown();
    messageStore.destroy();
    MessageStoreConfig messageStoreConfig = new MessageStoreConfig();
    File file = new File(messageStoreConfig.getStorePathRootDir());
    UtilAll.deleteFile(file);
}
Also used : MessageStoreConfig(org.apache.rocketmq.store.config.MessageStoreConfig) File(java.io.File) After(org.junit.After)

Aggregations

MessageStoreConfig (org.apache.rocketmq.store.config.MessageStoreConfig)33 BrokerConfig (org.apache.rocketmq.common.BrokerConfig)26 NettyClientConfig (org.apache.rocketmq.remoting.netty.NettyClientConfig)17 NettyServerConfig (org.apache.rocketmq.remoting.netty.NettyServerConfig)17 BrokerController (org.apache.rocketmq.broker.BrokerController)13 MQClientException (org.apache.rocketmq.client.exception.MQClientException)8 BrokerStatsManager (org.apache.rocketmq.store.stats.BrokerStatsManager)6 MQBrokerException (org.apache.rocketmq.client.exception.MQBrokerException)5 Test (org.junit.Test)5 UnsupportedEncodingException (java.io.UnsupportedEncodingException)4 RemotingException (org.apache.rocketmq.remoting.exception.RemotingException)4 EventDeliveryException (org.apache.flume.EventDeliveryException)3 LoggerContext (ch.qos.logback.classic.LoggerContext)2 JoranConfigurator (ch.qos.logback.classic.joran.JoranConfigurator)2 BufferedInputStream (java.io.BufferedInputStream)2 FileInputStream (java.io.FileInputStream)2 IOException (java.io.IOException)2 InputStream (java.io.InputStream)2 Properties (java.util.Properties)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)2