In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
What is the role of NewService in consul? I believe many inexperienced people don't know what to do about it. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.
NewService
Consort MustapiMae 1.4.1 Mutual sources.jarpowered plannar commax _ widget _ debase _ v1max _ agentbank _ modelle _ java
Public class NewService {@ SerializedName ("ID") private String id; @ SerializedName ("Name") private String name; @ SerializedName ("Tags") private List tags; @ 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 defines id, name, tags, address, meta, port, enableTagOverride, check, checks attributes
NewService.Check
Consort MustapiMae 1.4.1 Mutual sources.jarpowered plannar commax _ widget _ debase _ v1max _ agentbank _ modelle _ 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 defines script, interval, ttl, http, method, header, tcp, timeout, deregisterCriticalServiceAfter, tlsSkipVerify, status attributes
AgentConsulClient
Consort MustapiMui 1.4.1 Muir sources.jarhammer Universe commax ecwidmax consultus V1 AgentConsulClient.java
Public final class AgentConsulClient implements AgentClient {private final ConsulRawClient rawClient; / /. Public Response agentServiceRegister (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);}} /.}
The agentServiceRegister method of AgentConsulClient uses rawClient to send a put request to the url / v1/agent/service/register, sending the json data of newService.
Summary
NewService defines id, name, tags, address, meta, port, enableTagOverride, check, checks attributes
NewService.Check defines script, interval, ttl, http, method, header, tcp, timeout, deregisterCriticalServiceAfter, tlsSkipVerify, status attributes
The agentServiceRegister method of AgentConsulClient uses rawClient to send a put request to the url / v1/agent/service/register, sending the json data of newService.
After reading the above, have you mastered the role of NewService in consul? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.