218
spring.application.name=client
server.port=${port:8080}
eureka.client.serviceUrl.defaultZone=${EUREKA_URL:http://discovery-container:8761/eureka}
eureka.instance.prefer-ip-address=true
@EnableScheduling
@EnableDiscoveryClient
@SpringBootApplication
public class Client {
@Scheduled(fixedRate = 3000)
void call() {
RestTemplate rest = new RestTemplate();
ResponseEntity<String> res = rest.getForEntity("http://gateway-container:8762/service/info", String.class);
log.info("Call from: " + hostname + ", response: " + res.getBody());;
}
@Value("${HOSTNAME}")
String hostname;
private static Logger log = LoggerFactory.getLogger(Client.class);
public static void main(String[] args) {
SpringApplication.run(Client.class, args);
}
}
Content type
Image
Digest
Size
103.3 MB
Last updated
over 7 years ago
docker pull dockerworkshopsydor/microservices-architecture-client