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


Java HttpTinyClient类代码示例

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


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

示例1: fetch

import org.apache.rocketmq.common.utils.HttpTinyClient; //导入依赖的package包/类
@Override
public String fetch(String topic, String consumerGroup, String className) {
    String thisUrl = String.format("%s/%s.java", this.url, className);

    try {
        HttpResult result = HttpTinyClient.httpGet(thisUrl, null, null, "UTF-8", 5000);
        if (200 == result.code) {
            return result.content;
        }
    } catch (Exception e) {
        log.error(
            String.format("call <%s> exception, Topic: %s Group: %s", thisUrl, topic, consumerGroup), e);
    }

    return null;
}
 
开发者ID:lirenzuo,项目名称:rocketmq-rocketmq-all-4.1.0-incubating,代码行数:17,代码来源:HttpFilterClassFetchMethod.java

示例2: fetchNSAddr

import org.apache.rocketmq.common.utils.HttpTinyClient; //导入依赖的package包/类
public final String fetchNSAddr(boolean verbose, long timeoutMills) {
    String url = this.wsAddr;
    try {
        if (!UtilAll.isBlank(this.unitName)) {
            url = url + "-" + this.unitName + "?nofix=1";
        }
        HttpTinyClient.HttpResult result = HttpTinyClient.httpGet(url, null, null, "UTF-8", timeoutMills);
        if (200 == result.code) {
            String responseStr = result.content;
            if (responseStr != null) {
                return clearNewLine(responseStr);
            } else {
                log.error("fetch nameserver address is null");
            }
        } else {
            log.error("fetch nameserver address failed. statusCode={}", result.code);
        }
    } catch (IOException e) {
        if (verbose) {
            log.error("fetch name server address exception", e);
        }
    }

    if (verbose) {
        String errorMsg =
            "connect to " + url + " failed, maybe the domain name " + MixAll.getWSAddr() + " not bind in /etc/hosts";
        errorMsg += FAQUrl.suggestTodo(FAQUrl.NAME_SERVER_ADDR_NOT_EXIST_URL);

        log.warn(errorMsg);
    }
    return null;
}
 
开发者ID:lirenzuo,项目名称:rocketmq-rocketmq-all-4.1.0-incubating,代码行数:33,代码来源:TopAddressing.java

示例3: fetchNSAddr

import org.apache.rocketmq.common.utils.HttpTinyClient; //导入依赖的package包/类
public final String fetchNSAddr(boolean verbose, long timeoutMills) {
    String url = this.wsAddr;
    try {
        if (!UtilAll.isBlank(this.unitName)) {
            url = url + "-" + this.unitName + "?nofix=1";
        }
        HttpTinyClient.HttpResult result = HttpTinyClient.httpGet(url, null, null, "UTF-8", timeoutMills);
        if (200 == result.code) {
            String responseStr = result.content;
            if (responseStr != null) {
                return clearNewLine(responseStr);
            } else {
                log.error("fetch nameserver address is null");
            }
        } else {
            log.error("fetch nameserver address failed. statusCode={}", result.code);
        }
    } catch (IOException e) {
        if (verbose) {
            log.error("fetch name server address exception", e);
        }
    }

    if (verbose) {
        String errorMsg =
            "connect to " + url + " failed, maybe the domain name " + MixAll.WS_DOMAIN_NAME + " not bind in /etc/hosts";
        errorMsg += FAQUrl.suggestTodo(FAQUrl.NAME_SERVER_ADDR_NOT_EXIST_URL);

        log.warn(errorMsg);
    }
    return null;
}
 
开发者ID:lyy4j,项目名称:rmq4note,代码行数:33,代码来源:TopAddressing.java


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