• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java BrokerConfig类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中com.alibaba.rocketmq.common.BrokerConfig的典型用法代码示例。如果您正苦于以下问题:Java BrokerConfig类的具体用法?Java BrokerConfig怎么用?Java BrokerConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

BrokerConfig类属于com.alibaba.rocketmq.common包,在下文中一共展示了BrokerConfig类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: test_flushConsumerOffset

点赞 2

import com.alibaba.rocketmq.common.BrokerConfig; //导入依赖的package包/类
@Test
public void test_flushConsumerOffset() throws Exception {
    BrokerController brokerController = new BrokerController(//
        new BrokerConfig(), //
        new NettyServerConfig(), //
        new NettyClientConfig(), //
        new MessageStoreConfig());
    boolean initResult = brokerController.initialize();
    System.out.println("initialize " + initResult);
    brokerController.start();

    ConsumerOffsetManager consumerOffsetManager = new ConsumerOffsetManager(brokerController);

    Random random = new Random();

    for (int i = 0; i < 100; i++) {
        String group = "DIANPU_GROUP_" + i;
        for (int id = 0; id < 16; id++) {
            consumerOffsetManager.commitOffset(group, "TOPIC_A", id,
                random.nextLong() % 1024 * 1024 * 1024);
            consumerOffsetManager.commitOffset(group, "TOPIC_B", id,
                random.nextLong() % 1024 * 1024 * 1024);
            consumerOffsetManager.commitOffset(group, "TOPIC_C", id,
                random.nextLong() % 1024 * 1024 * 1024);
        }
    }

    consumerOffsetManager.persist();

    brokerController.shutdown();
}
 

开发者ID:y123456yz,
项目名称:reading-and-annotate-rocketmq-3.4.6,
代码行数:32,
代码来源:ConsumerOffsetManagerTest.java

示例2: test_flushTopicConfig

点赞 2

import com.alibaba.rocketmq.common.BrokerConfig; //导入依赖的package包/类
@Test
public void test_flushTopicConfig() throws Exception {
    BrokerController brokerController = new BrokerController(//
        new BrokerConfig(), //
        new NettyServerConfig(), //
        new NettyClientConfig(), //
        new MessageStoreConfig());
    boolean initResult = brokerController.initialize();
    System.out.println("initialize " + initResult);
    brokerController.start();

    TopicConfigManager topicConfigManager = new TopicConfigManager(brokerController);

    TopicConfig topicConfig =
            topicConfigManager.createTopicInSendMessageMethod("TestTopic_SEND", MixAll.DEFAULT_TOPIC,
                null, 4, 0);
    assertTrue(topicConfig != null);

    System.out.println(topicConfig);

    for (int i = 0; i < 10; i++) {
        String topic = "UNITTEST-" + i;
        topicConfig =
                topicConfigManager
                    .createTopicInSendMessageMethod(topic, MixAll.DEFAULT_TOPIC, null, 4, 0);
        assertTrue(topicConfig != null);
    }

    topicConfigManager.persist();

    brokerController.shutdown();
}
 

开发者ID:y123456yz,
项目名称:reading-and-annotate-rocketmq-3.4.6,
代码行数:33,
代码来源:TopicConfigManagerTest.java

示例3: BrokerController

点赞 2

import com.alibaba.rocketmq.common.BrokerConfig; //导入依赖的package包/类
public BrokerController(//
        final BrokerConfig brokerConfig, //
        final NettyServerConfig nettyServerConfig, //
        final NettyClientConfig nettyClientConfig, //
        final MessageStoreConfig messageStoreConfig //
) {
    this.brokerConfig = brokerConfig;
    this.nettyServerConfig = nettyServerConfig;
    this.nettyClientConfig = nettyClientConfig;
    this.messageStoreConfig = messageStoreConfig;
    this.consumerOffsetManager = new ConsumerOffsetManager(this);
    this.topicConfigManager = new TopicConfigManager(this);
    this.pullMessageProcessor = new PullMessageProcessor(this);
    this.pullRequestHoldService = new PullRequestHoldService(this);
    this.consumerIdsChangeListener = new DefaultConsumerIdsChangeListener(this);
    this.consumerManager = new ConsumerManager(this.consumerIdsChangeListener);
    this.producerManager = new ProducerManager();
    this.clientHousekeepingService = new ClientHousekeepingService(this);
    this.defaultTransactionCheckExecuter = new DefaultTransactionCheckExecuter(this);
    this.broker2Client = new Broker2Client(this);
    this.subscriptionGroupManager = new SubscriptionGroupManager(this);
    this.brokerOuterAPI = new BrokerOuterAPI(nettyClientConfig);
    this.filterServerManager = new FilterServerManager(this);

    if (this.brokerConfig.getNamesrvAddr() != null) {
        this.brokerOuterAPI.updateNameServerAddressList(this.brokerConfig.getNamesrvAddr());
        log.info("user specfied name server address: {}", this.brokerConfig.getNamesrvAddr());
    }

    this.slaveSynchronize = new SlaveSynchronize(this);

    this.sendThreadPoolQueue =
            new LinkedBlockingQueue<Runnable>(this.brokerConfig.getSendThreadPoolQueueCapacity());

    this.pullThreadPoolQueue =
            new LinkedBlockingQueue<Runnable>(this.brokerConfig.getPullThreadPoolQueueCapacity());

    this.brokerStatsManager = new BrokerStatsManager();
}
 

开发者ID:diwayou,
项目名称:rocketmq-all-trans,
代码行数:40,
代码来源:BrokerController.java

示例4: test_flushTopicConfig

点赞 2

import com.alibaba.rocketmq.common.BrokerConfig; //导入依赖的package包/类
@Test
public void test_flushTopicConfig() throws Exception {
    BrokerController brokerController = new BrokerController(//
        new BrokerConfig(), //
        new NettyServerConfig(), //
        new NettyClientConfig(), //
        new MessageStoreConfig());
    boolean initResult = brokerController.initialize();
    System.out.println("initialize " + initResult);
    brokerController.start();

    TopicConfigManager topicConfigManager = new TopicConfigManager(brokerController);

    TopicConfig topicConfig =
            topicConfigManager.createTopicInSendMessageMethod("TestTopic_SEND", MixAll.DEFAULT_TOPIC,
                null, 4);
    assertTrue(topicConfig != null);

    System.out.println(topicConfig);

    for (int i = 0; i < 10; i++) {
        String topic = "UNITTEST-" + i;
        topicConfig =
                topicConfigManager.createTopicInSendMessageMethod(topic, MixAll.DEFAULT_TOPIC, null, 4);
        assertTrue(topicConfig != null);
    }

    topicConfigManager.persist();

    brokerController.shutdown();
}
 

开发者ID:diwayou,
项目名称:rocketmq-all-trans,
代码行数:32,
代码来源:TopicConfigManagerTest.java

示例5: BrokerController

点赞 2

import com.alibaba.rocketmq.common.BrokerConfig; //导入依赖的package包/类
public BrokerController(//
        final BrokerConfig brokerConfig, //
        final NettyServerConfig nettyServerConfig, //
        final NettyClientConfig nettyClientConfig, //
        final MessageStoreConfig messageStoreConfig //
) {
    this.brokerConfig = brokerConfig;
    this.nettyServerConfig = nettyServerConfig;
    this.nettyClientConfig = nettyClientConfig;
    this.messageStoreConfig = messageStoreConfig;
    this.consumerOffsetManager = new ConsumerOffsetManager(this);
    this.topicConfigManager = new TopicConfigManager(this);
    this.pullMessageProcessor = new PullMessageProcessor(this);
    this.pullRequestHoldService = new PullRequestHoldService(this);
    this.consumerIdsChangeListener = new DefaultConsumerIdsChangeListener(this);
    this.consumerManager = new ConsumerManager(this.consumerIdsChangeListener);
    this.producerManager = new ProducerManager();
    this.clientHousekeepingService = new ClientHousekeepingService(this);
    this.defaultTransactionCheckExecuter = new DefaultTransactionCheckExecuter(this);
    this.broker2Client = new Broker2Client(this);
    this.subscriptionGroupManager = new SubscriptionGroupManager(this);
    this.brokerOuterAPI = new BrokerOuterAPI(nettyClientConfig);

    if (this.brokerConfig.getNamesrvAddr() != null) {
        this.brokerOuterAPI.updateNameServerAddressList(this.brokerConfig.getNamesrvAddr());
        log.info("user specfied name server address: {}", this.brokerConfig.getNamesrvAddr());
    }

    this.slaveSynchronize = new SlaveSynchronize(this);
    this.digestLogManager = new DigestLogManager(this);

    this.sendThreadPoolQueue =
            new LinkedBlockingQueue<Runnable>(this.brokerConfig.getSendThreadPoolQueueCapacity());

    this.pullThreadPoolQueue =
            new LinkedBlockingQueue<Runnable>(this.brokerConfig.getPullThreadPoolQueueCapacity());
}
 

开发者ID:brucechan0921,
项目名称:RocketMQ-3.0.8,
代码行数:38,
代码来源:BrokerController.java

示例6: test_sendMessage

点赞 2

import com.alibaba.rocketmq.common.BrokerConfig; //导入依赖的package包/类
@Test
public void test_sendMessage() throws Exception {
    BrokerController brokerController = new BrokerController(//
        new BrokerConfig(), //
        new NettyServerConfig(), //
        new NettyClientConfig(), //
        new MessageStoreConfig());
    boolean initResult = brokerController.initialize();
    System.out.println("initialize " + initResult);

    brokerController.start();

    MQClientAPIImpl client = new MQClientAPIImpl(new NettyClientConfig(), null, null, null);
    client.start();

    for (int i = 0; i < 100000; i++) {
        String topic = "UnitTestTopic_" + i % 3;
        Message msg = new Message(topic, "TAG1 TAG2", "100200300", ("Hello, Nice world\t" + i).getBytes());
        msg.setDelayTimeLevel(i % 3 + 1);

        try {
            SendMessageRequestHeader requestHeader = new SendMessageRequestHeader();
            requestHeader.setProducerGroup("abc");
            requestHeader.setTopic(msg.getTopic());
            requestHeader.setDefaultTopic(MixAll.DEFAULT_TOPIC);
            requestHeader.setDefaultTopicQueueNums(4);
            requestHeader.setQueueId(i % 4);
            requestHeader.setSysFlag(0);
            requestHeader.setBornTimestamp(System.currentTimeMillis());
            requestHeader.setFlag(msg.getFlag());
            requestHeader.setProperties(MessageDecoder.messageProperties2String(msg.getProperties()));

            SendResult result =
                    client.sendMessage("127.0.0.1:10911", "brokerName", msg, requestHeader, 1000 * 5, CommunicationMode.SYNC, null);
            System.out.println(i + "\t" + result);
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }

    client.shutdown();

    brokerController.shutdown();
}
 

开发者ID:y123456yz,
项目名称:reading-and-annotate-rocketmq-3.4.6,
代码行数:46,
代码来源:SendMessageTest.java

示例7: getBrokerConfig

点赞 2

import com.alibaba.rocketmq.common.BrokerConfig; //导入依赖的package包/类
public BrokerConfig getBrokerConfig() {
    return brokerConfig;
}
 

开发者ID:diwayou,
项目名称:rocketmq-all-trans,
代码行数:4,
代码来源:BrokerController.java

示例8: test_sendMessage

点赞 2

import com.alibaba.rocketmq.common.BrokerConfig; //导入依赖的package包/类
@Test
public void test_sendMessage() throws Exception {
    BrokerController brokerController = new BrokerController(//
        new BrokerConfig(), //
        new NettyServerConfig(), //
        new NettyClientConfig(), //
        new MessageStoreConfig());
    boolean initResult = brokerController.initialize();
    System.out.println("initialize " + initResult);

    brokerController.start();

    MQClientAPIImpl client = new MQClientAPIImpl(new NettyClientConfig(), null);
    client.start();

    for (int i = 0; i < 100000; i++) {
        String topic = "UnitTestTopic_" + i % 3;
        Message msg =
                new Message(topic, "TAG1 TAG2", "100200300", ("Hello, Nice world\t" + i).getBytes());
        msg.setDelayTimeLevel(i % 3 + 1);

        try {
            SendMessageRequestHeader requestHeader = new SendMessageRequestHeader();
            requestHeader.setProducerGroup("abc");
            requestHeader.setTopic(msg.getTopic());
            requestHeader.setDefaultTopic(MixAll.DEFAULT_TOPIC);
            requestHeader.setDefaultTopicQueueNums(4);
            requestHeader.setQueueId(i % 4);
            requestHeader.setSysFlag(0);
            requestHeader.setBornTimestamp(System.currentTimeMillis());
            requestHeader.setFlag(msg.getFlag());
            requestHeader.setProperties(MessageDecoder.messageProperties2String(msg.getProperties()));

            SendResult result =
                    client.sendMessage("127.0.0.1:10911", "brokerName", msg, requestHeader, 1000 * 5,
                        CommunicationMode.SYNC, null);
            System.out.println(i + "\t" + result);
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }

    client.shutdown();

    brokerController.shutdown();
}
 

开发者ID:diwayou,
项目名称:rocketmq-all-trans,
代码行数:48,
代码来源:SendMessageTest.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)