Search in sources :

Example 16 with MessageStoreConfig

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

the class RocketMQLocalCluster method startBroker.

private void startBroker() throws Exception {
    System.setProperty(RemotingCommand.REMOTING_VERSION_KEY, Integer.toString(MQVersion.CURRENT_VERSION));
    BrokerConfig brokerConfig = new BrokerConfig();
    brokerConfig.setNamesrvAddr(nameserverAddr);
    brokerConfig.setBrokerId(MixAll.MASTER_ID);
    NettyServerConfig nettyServerConfig = new NettyServerConfig();
    nettyServerConfig.setListenPort(10911);
    NettyClientConfig nettyClientConfig = new NettyClientConfig();
    MessageStoreConfig messageStoreConfig = new MessageStoreConfig();
    brokerController = new BrokerController(brokerConfig, nettyServerConfig, nettyClientConfig, messageStoreConfig);
    boolean initResult = brokerController.initialize();
    if (!initResult) {
        brokerController.shutdown();
        throw new Exception("Broker init failure!");
    }
    brokerController.start();
}
Also used : MessageStoreConfig(org.apache.rocketmq.store.config.MessageStoreConfig) BrokerConfig(org.apache.rocketmq.common.BrokerConfig) NettyClientConfig(org.apache.rocketmq.remoting.netty.NettyClientConfig) BrokerController(org.apache.rocketmq.broker.BrokerController) NettyServerConfig(org.apache.rocketmq.remoting.netty.NettyServerConfig)

Example 17 with MessageStoreConfig

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

the class TestRocketMQServer method startBroker.

/**
 * Starts a test broker.
 *
 * @throws Exception If fails.
 */
private void startBroker() throws Exception {
    BrokerConfig brokerCfg = new BrokerConfig();
    NettyServerConfig nettySrvCfg = new NettyServerConfig();
    MessageStoreConfig storeCfg = new MessageStoreConfig();
    brokerCfg.setBrokerName(TEST_BROKER);
    brokerCfg.setBrokerClusterName(TEST_CLUSTER);
    brokerCfg.setBrokerIP1(TEST_IP);
    brokerCfg.setNamesrvAddr(TEST_IP + ":" + NAME_SERVER_PORT);
    storeCfg.setStorePathRootDir(System.getProperty("java.io.tmpdir") + separator + "store-" + UUID.randomUUID());
    storeCfg.setStorePathCommitLog(System.getProperty("java.io.tmpdir") + separator + "commitlog");
    storeCfg.setHaListenPort(HA_PORT);
    nettySrvCfg.setListenPort(BROKER_PORT);
    broker = new BrokerController(brokerCfg, nettySrvCfg, new NettyClientConfig(), storeCfg);
    broker.initialize();
    broker.start();
    log.info("Started broker [" + TEST_BROKER + "] at " + BROKER_PORT);
}
Also used : MessageStoreConfig(org.apache.rocketmq.store.config.MessageStoreConfig) BrokerConfig(org.apache.rocketmq.common.BrokerConfig) NettyClientConfig(org.apache.rocketmq.remoting.netty.NettyClientConfig) BrokerController(org.apache.rocketmq.broker.BrokerController) NettyServerConfig(org.apache.rocketmq.remoting.netty.NettyServerConfig)

Example 18 with MessageStoreConfig

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

the class RocketMQServerMock method startBroker.

private void startBroker() throws Exception {
    System.setProperty(RemotingCommand.REMOTING_VERSION_KEY, Integer.toString(MQVersion.CURRENT_VERSION));
    BrokerConfig brokerConfig = new BrokerConfig();
    brokerConfig.setNamesrvAddr(getNameServerAddr());
    brokerConfig.setBrokerId(MixAll.MASTER_ID);
    NettyServerConfig nettyServerConfig = new NettyServerConfig();
    nettyServerConfig.setListenPort(brokerPort);
    NettyClientConfig nettyClientConfig = new NettyClientConfig();
    MessageStoreConfig messageStoreConfig = new MessageStoreConfig();
    brokerController = new BrokerController(brokerConfig, nettyServerConfig, nettyClientConfig, messageStoreConfig);
    boolean initResult = brokerController.initialize();
    if (!initResult) {
        brokerController.shutdown();
        throw new Exception("Broker init failure!");
    }
    brokerController.start();
}
Also used : MessageStoreConfig(org.apache.rocketmq.store.config.MessageStoreConfig) BrokerConfig(org.apache.rocketmq.common.BrokerConfig) NettyClientConfig(org.apache.rocketmq.remoting.netty.NettyClientConfig) BrokerController(org.apache.rocketmq.broker.BrokerController) NettyServerConfig(org.apache.rocketmq.remoting.netty.NettyServerConfig) MQClientException(org.apache.rocketmq.client.exception.MQClientException)

Example 19 with MessageStoreConfig

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

the class IntegrationTestBase method createAndStartBroker.

public static BrokerController createAndStartBroker(String nsAddr) {
    String baseDir = createBaseDir();
    BrokerConfig brokerConfig = new BrokerConfig();
    NettyServerConfig nettyServerConfig = new NettyServerConfig();
    NettyClientConfig nettyClientConfig = new NettyClientConfig();
    MessageStoreConfig storeConfig = new MessageStoreConfig();
    brokerConfig.setBrokerName(BROKER_NAME_PREFIX + BROKER_INDEX.getAndIncrement());
    brokerConfig.setBrokerIP1("127.0.0.1");
    brokerConfig.setNamesrvAddr(nsAddr);
    brokerConfig.setEnablePropertyFilter(true);
    storeConfig.setStorePathRootDir(baseDir);
    storeConfig.setStorePathCommitLog(baseDir + SEP + "commitlog");
    storeConfig.setHaListenPort(8000 + random.nextInt(1000));
    storeConfig.setMapedFileSizeCommitLog(COMMIT_LOG_SIZE);
    storeConfig.setMaxIndexNum(INDEX_NUM);
    storeConfig.setMaxHashSlotNum(INDEX_NUM * 4);
    nettyServerConfig.setListenPort(10000 + random.nextInt(1000));
    BrokerController brokerController = new BrokerController(brokerConfig, nettyServerConfig, nettyClientConfig, storeConfig);
    try {
        Assert.assertTrue(brokerController.initialize());
        logger.info("Broker Start name:{} addr:{}", brokerConfig.getBrokerName(), brokerController.getBrokerAddr());
        brokerController.start();
    } catch (Exception e) {
        logger.info("Broker start failed");
        System.exit(1);
    }
    BROKER_CONTROLLERS.add(brokerController);
    return brokerController;
}
Also used : MessageStoreConfig(org.apache.rocketmq.store.config.MessageStoreConfig) BrokerConfig(org.apache.rocketmq.common.BrokerConfig) NettyClientConfig(org.apache.rocketmq.remoting.netty.NettyClientConfig) BrokerController(org.apache.rocketmq.broker.BrokerController) NettyServerConfig(org.apache.rocketmq.remoting.netty.NettyServerConfig)

Example 20 with MessageStoreConfig

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

the class MessageStoreWithFilterTest method gen.

protected DefaultMessageStore gen(ConsumerFilterManager filterManager) throws Exception {
    MessageStoreConfig messageStoreConfig = buildStoreConfig(commitLogFileSize, cqFileSize, true, cqExtFileSize);
    BrokerConfig brokerConfig = new BrokerConfig();
    brokerConfig.setEnableCalcFilterBitMap(true);
    brokerConfig.setMaxErrorRateOfBloomFilter(20);
    brokerConfig.setExpectConsumerNumUseFilter(64);
    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);
    master.getDispatcherList().addFirst(new CommitLogDispatcher() {

        @Override
        public void dispatch(DispatchRequest request) {
            try {
            } catch (Throwable e) {
                e.printStackTrace();
            }
        }
    });
    master.getDispatcherList().addFirst(new CommitLogDispatcherCalcBitMap(brokerConfig, filterManager));
    assertThat(master.load()).isTrue();
    master.start();
    return master;
}
Also used : BrokerStatsManager(org.apache.rocketmq.store.stats.BrokerStatsManager) BrokerConfig(org.apache.rocketmq.common.BrokerConfig) DefaultMessageStore(org.apache.rocketmq.store.DefaultMessageStore) DispatchRequest(org.apache.rocketmq.store.DispatchRequest) MessageStoreConfig(org.apache.rocketmq.store.config.MessageStoreConfig) MessageArrivingListener(org.apache.rocketmq.store.MessageArrivingListener) CommitLogDispatcher(org.apache.rocketmq.store.CommitLogDispatcher)

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