当前位置: 首页>>代码示例>>Java>>正文


Java MixAll.file2String方法代码示例

本文整理汇总了Java中org.apache.rocketmq.common.MixAll.file2String方法的典型用法代码示例。如果您正苦于以下问题:Java MixAll.file2String方法的具体用法?Java MixAll.file2String怎么用?Java MixAll.file2String使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.rocketmq.common.MixAll的用法示例。


在下文中一共展示了MixAll.file2String方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import org.apache.rocketmq.common.MixAll; //导入方法依赖的package包/类
public static void main(String[] args) throws InterruptedException, MQClientException, IOException {
    DefaultMQPushConsumer consumer = new DefaultMQPushConsumer("ConsumerGroupNamecc4");

    ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
    File classFile = new File(classLoader.getResource("MessageFilterImpl.java").getFile());

    String filterCode = MixAll.file2String(classFile);
    consumer.subscribe("TopicTest", "org.apache.rocketmq.example.filter.MessageFilterImpl",
        filterCode);

    consumer.registerMessageListener(new MessageListenerConcurrently() {

        @Override
        public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> msgs,
            ConsumeConcurrentlyContext context) {
            System.out.printf(Thread.currentThread().getName() + " Receive New Messages: " + msgs + "%n");
            return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
        }
    });

    consumer.start();

    System.out.printf("Consumer Started.%n");
}
 
开发者ID:lirenzuo,项目名称:rocketmq-rocketmq-all-4.1.0-incubating,代码行数:25,代码来源:Consumer.java

示例2: load

import org.apache.rocketmq.common.MixAll; //导入方法依赖的package包/类
public void load() {
    String content = null;
    try {
        content = MixAll.file2String(this.namesrvController.getNamesrvConfig().getKvConfigPath());
    } catch (IOException e) {
        log.warn("Load KV config table exception", e);
    }
    if (content != null) {
        KVConfigSerializeWrapper kvConfigSerializeWrapper =
            KVConfigSerializeWrapper.fromJson(content, KVConfigSerializeWrapper.class);
        if (null != kvConfigSerializeWrapper) {
            this.configTable.putAll(kvConfigSerializeWrapper.getConfigTable());
            log.info("load KV config table OK");
        }
    }
}
 
开发者ID:lirenzuo,项目名称:rocketmq-rocketmq-all-4.1.0-incubating,代码行数:17,代码来源:KVConfigManager.java

示例3: main

import org.apache.rocketmq.common.MixAll; //导入方法依赖的package包/类
public static void main(String[] args) throws InterruptedException, MQClientException {
    DefaultMQPushConsumer consumer = new DefaultMQPushConsumer("ConsumerGroupNamecc4");

    ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
    File classFile = new File(classLoader.getResource("MessageFilterImpl.java").getFile());

    String filterCode = MixAll.file2String(classFile);
    consumer.subscribe("TopicTest", "org.apache.rocketmq.example.filter.MessageFilterImpl",
        filterCode);

    consumer.registerMessageListener(new MessageListenerConcurrently() {

        @Override
        public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> msgs,
            ConsumeConcurrentlyContext context) {
            System.out.printf(Thread.currentThread().getName() + " Receive New Messages: " + msgs + "%n");
            return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
        }
    });

    consumer.start();

    System.out.printf("Consumer Started.%n");
}
 
开发者ID:lyy4j,项目名称:rmq4note,代码行数:25,代码来源:Consumer.java

示例4: readLocalOffset

import org.apache.rocketmq.common.MixAll; //导入方法依赖的package包/类
private OffsetSerializeWrapper readLocalOffset() throws MQClientException {
    String content = MixAll.file2String(this.storePath);
    if (null == content || content.length() == 0) {
        return this.readLocalOffsetBak();
    } else {
        OffsetSerializeWrapper offsetSerializeWrapper = null;
        try {
            offsetSerializeWrapper =
                OffsetSerializeWrapper.fromJson(content, OffsetSerializeWrapper.class);
        } catch (Exception e) {
            log.warn("readLocalOffset Exception, and try to correct", e);
            return this.readLocalOffsetBak();
        }

        return offsetSerializeWrapper;
    }
}
 
开发者ID:lyy4j,项目名称:rmq4note,代码行数:18,代码来源:LocalFileOffsetStore.java

示例5: readLocalOffsetBak

import org.apache.rocketmq.common.MixAll; //导入方法依赖的package包/类
private OffsetSerializeWrapper readLocalOffsetBak() throws MQClientException {
    String content = MixAll.file2String(this.storePath + ".bak");
    if (content != null && content.length() > 0) {
        OffsetSerializeWrapper offsetSerializeWrapper = null;
        try {
            offsetSerializeWrapper =
                OffsetSerializeWrapper.fromJson(content, OffsetSerializeWrapper.class);
        } catch (Exception e) {
            log.warn("readLocalOffset Exception", e);
            throw new MQClientException("readLocalOffset Exception, maybe fastjson version too low" //
                + FAQUrl.suggestTodo(FAQUrl.LOAD_JSON_EXCEPTION), //
                e);
        }
        return offsetSerializeWrapper;
    }

    return null;
}
 
开发者ID:lyy4j,项目名称:rmq4note,代码行数:19,代码来源:LocalFileOffsetStore.java

示例6: load

import org.apache.rocketmq.common.MixAll; //导入方法依赖的package包/类
public void load() {
    String content = MixAll.file2String(this.namesrvController.getNamesrvConfig().getKvConfigPath());
    if (content != null) {
        KVConfigSerializeWrapper kvConfigSerializeWrapper =
            KVConfigSerializeWrapper.fromJson(content, KVConfigSerializeWrapper.class);
        if (null != kvConfigSerializeWrapper) {
            this.configTable.putAll(kvConfigSerializeWrapper.getConfigTable());
            log.info("load KV config table OK");
        }
    }
}
 
开发者ID:lyy4j,项目名称:rmq4note,代码行数:12,代码来源:KVConfigManager.java

示例7: createTableSql

import org.apache.rocketmq.common.MixAll; //导入方法依赖的package包/类
private String createTableSql() {
    URL resource = JDBCTransactionStore.class.getClassLoader().getResource("transaction.sql");
    String fileContent = MixAll.file2String(resource);
    return fileContent;
}
 
开发者ID:lirenzuo,项目名称:rocketmq-rocketmq-all-4.1.0-incubating,代码行数:6,代码来源:JDBCTransactionStore.java


注:本文中的org.apache.rocketmq.common.MixAll.file2String方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。