I have java code to insert services into my consul sevice, using spring-cloud-starter-consul-all and java code like this:
if (response.getValue().isEmpty()) {
NewService service = new NewService();
service.setAddress("serverhere.com");
service.setPort(8200);
service.setId("servideId");
service.setName("serviceName");
client.agentServiceRegister(service);
}
I need to add also parameters, or path, like:
http://serverhere.com:8080/parameter1/parameter2.
I do not know where to insert the parameters: /parameter1/parameter2.
I have tried adding this code:
//HealthCheck
NewService.Check serviceCheck = new NewService.Check();
serviceCheck.setHttp(service.getHealthCheck());
serviceCheck.setInterval(healthCheckInterval);
serviceCheck.setTimeout(healthCheckTimeout);
//Path
NewService.Check serviceCheckPath = new NewService.Check();
serviceCheckPath.setScript("/parameter1/parameter2");
serviceCheckPath.setInterval(healthCheckInterval);
List<Check> serviceCheckList = new ArrayList();
serviceCheckList.add(serviceCheck);
serviceCheckList.add(serviceCheckPath);
newService.setChecks(serviceCheckList);
client.agentServiceRegister(newService);
I get this error: OperationException(statusCode=400, statusMessage='Bad Request', statusContent='Request decode failed: json: unknown field "Script"')
Could you help me to find the appropiate field to save path related to a service. Thank you in advance.