符合中小企业对网站设计、功能常规化式的企业展示型网站建设
本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...
商城网站建设因基本功能的需求不同费用上面也有很大的差别...
手机微信网站开发、微信官网、微信商城网站...
consul中NewService的作用是什么,相信很多没有经验的人对此束手无策,为此本文总结了问题出现的原因和解决方法,通过这篇文章希望你能解决这个问题。
成都创新互联企业建站,10多年网站建设经验,专注于网站建设技术,精于网页设计,有多年建站和网站代运营经验,设计师为客户打造网络企业风格,提供周到的建站售前咨询和贴心的售后服务。对于网站设计、成都做网站中不同领域进行深入了解和探索,创新互联在网站建设中充分了解客户行业的需求,以灵动的思维在网页中充分展现,通过对客户行业精准市场调研,为客户提供的解决方案。
consul-api-1.4.1-sources.jar!/com/ecwid/consul/v1/agent/model/NewService.java
public class NewService { @SerializedName("ID") private String id; @SerializedName("Name") private String name; @SerializedName("Tags") private Listtags; @SerializedName("Address") private String address; @SerializedName("Meta") private Map meta; @SerializedName("Port") private Integer port; @SerializedName("EnableTagOverride") private Boolean enableTagOverride; @SerializedName("Check") private Check check; @SerializedName("Checks") private List checks; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public List getTags() { return tags; } public void setTags(List tags) { this.tags = tags; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public Map getMeta() { return meta; } public void setMeta(Map meta) { this.meta = meta; } public Integer getPort() { return port; } public void setPort(Integer port) { this.port = port; } public Boolean getEnableTagOverride() { return enableTagOverride; } public void setEnableTagOverride(Boolean enableTagOverride) { this.enableTagOverride = enableTagOverride; } public Check getCheck() { return check; } public void setCheck(Check check) { this.check = check; } public List getChecks() { return checks; } public void setChecks(List checks) { this.checks = checks; } @Override public String toString() { return "NewService{" + "id='" + id + '\'' + ", name='" + name + '\'' + ", tags=" + tags + ", address='" + address + '\'' + ", meta=" + meta + ", port=" + port + ", enableTagOverride=" + enableTagOverride + ", check=" + check + ", checks=" + checks + '}'; } }
NewService定义了id、name、tags、address、meta、port、enableTagOverride、check、checks属性
consul-api-1.4.1-sources.jar!/com/ecwid/consul/v1/agent/model/NewService.java
public static class Check { @SerializedName("Script") private String script; @SerializedName("Interval") private String interval; @SerializedName("TTL") private String ttl; @SerializedName("HTTP") private String http; @SerializedName("Method") private String method; @SerializedName("Header") private Map> header; @SerializedName("TCP") private String tcp; @SerializedName("Timeout") private String timeout; @SerializedName("DeregisterCriticalServiceAfter") private String deregisterCriticalServiceAfter; @SerializedName("TLSSkipVerify") private Boolean tlsSkipVerify; @SerializedName("Status") private String status; public String getScript() { return script; } public void setScript(String script) { this.script = script; } public String getInterval() { return interval; } public void setInterval(String interval) { this.interval = interval; } public String getTtl() { return ttl; } public void setTtl(String ttl) { this.ttl = ttl; } public String getHttp() { return http; } public void setHttp(String http) { this.http = http; } public String getMethod() { return method; } public void setMethod(String method) { this.method = method; } public Map > getHeader() { return header; } public void setHeader(Map > header) { this.header = header; } public String getTcp() { return tcp; } public void setTcp(String tcp) { this.tcp = tcp; } public String getTimeout() { return timeout; } public void setTimeout(String timeout) { this.timeout = timeout; } public String getDeregisterCriticalServiceAfter() { return deregisterCriticalServiceAfter; } public void setDeregisterCriticalServiceAfter(String deregisterCriticalServiceAfter) { this.deregisterCriticalServiceAfter = deregisterCriticalServiceAfter; } public Boolean getTlsSkipVerify() { return tlsSkipVerify; } public void setTlsSkipVerify(Boolean tlsSkipVerify) { this.tlsSkipVerify = tlsSkipVerify; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } @Override public String toString() { return "Check{" + "script='" + script + '\'' + ", interval='" + interval + '\'' + ", ttl='" + ttl + '\'' + ", http='" + http + '\'' + ", method='" + method + '\'' + ", header=" + header + ", tcp='" + tcp + '\'' + ", timeout='" + timeout + '\'' + ", deregisterCriticalServiceAfter='" + deregisterCriticalServiceAfter + '\'' + ", tlsSkipVerify=" + tlsSkipVerify + ", status='" + status + '\'' + '}'; } }
NewService.Check定义了script、interval、ttl、http、method、header、tcp、timeout、deregisterCriticalServiceAfter、tlsSkipVerify、status属性
consul-api-1.4.1-sources.jar!/com/ecwid/consul/v1/agent/AgentConsulClient.java
public final class AgentConsulClient implements AgentClient { private final ConsulRawClient rawClient; //...... public ResponseagentServiceRegister(NewService newService) { return agentServiceRegister(newService, null); } public Response agentServiceRegister(NewService newService, String token) { UrlParameters tokenParam = token != null ? new SingleUrlParameters("token", token) : null; String json = GsonFactory.getGson().toJson(newService); RawResponse rawResponse = rawClient.makePutRequest("/v1/agent/service/register", json, tokenParam); if (rawResponse.getStatusCode() == 200) { return new Response (null, rawResponse); } else { throw new OperationException(rawResponse); } } //...... }
AgentConsulClient的agentServiceRegister方法使用rawClient向/v1/agent/service/register
这个url发送put请求,把newService的json数据发送过去
NewService定义了id、name、tags、address、meta、port、enableTagOverride、check、checks属性
NewService.Check定义了script、interval、ttl、http、method、header、tcp、timeout、deregisterCriticalServiceAfter、tlsSkipVerify、status属性
AgentConsulClient的agentServiceRegister方法使用rawClient向/v1/agent/service/register
这个url发送put请求,把newService的json数据发送过去
看完上述内容,你们掌握consul中NewService的作用是什么的方法了吗?如果还想学到更多技能或想了解更多相关内容,欢迎关注创新互联行业资讯频道,感谢各位的阅读!