class KubernetesCatalogWatch implements ApplicationEventPublisherAware {

	private static final ParameterizedTypeReference<List<EndpointNameAndNamespace>> TYPE = new ParameterizedTypeReference<>() {

	};

	private static final LogAccessor LOG = new LogAccessor(LogFactory.getLog(KubernetesCatalogWatch.class));

	private final AtomicReference<List<EndpointNameAndNamespace>> catalogState = new AtomicReference<>(List.of());

	private final RestTemplate restTemplate;

	private ApplicationEventPublisher publisher;

	KubernetesCatalogWatch(RestTemplateBuilder builder, KubernetesDiscoveryProperties properties) {
		this.restTemplate = builder.rootUri(properties.discoveryServerUrl()).build();
	}

	@Override
	public void setApplicationEventPublisher(ApplicationEventPublisher publisher) {
		this.publisher = publisher;
	}

	@Scheduled(fixedDelayString = "${" + CATALOG_WATCH_PROPERTY_WITH_DEFAULT_VALUE + "}")
	public void catalogServicesWatch() {<FILL_FUNCTION_BODY>}

}

		try {
			List<EndpointNameAndNamespace> currentState = restTemplate.exchange("/state", HttpMethod.GET, null, TYPE)
					.getBody();

			if (!catalogState.get().equals(currentState)) {
				LOG.debug(() -> "Received update from kubernetes discovery http client: " + currentState);
				publisher.publishEvent(new HeartbeatEvent(this, currentState));
			}

			catalogState.set(currentState);
		}
		catch (Exception e) {
			LOG.error(e, () -> "Error watching Kubernetes Services");
		}
	
<no_super_class>