org.kiwiproject.registry.client.NoOpRegistryClient Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of service-discovery-client Show documentation
Show all versions of service-discovery-client Show documentation
Abstract service discovery API for service registration and lookup
package org.kiwiproject.registry.client;
import lombok.extern.slf4j.Slf4j;
import org.kiwiproject.registry.model.ServiceInstance;
import java.util.List;
import java.util.Optional;
/**
* A "no-op" implementation of {@link RegistryClient}.
*/
@Slf4j
public class NoOpRegistryClient implements RegistryClient {
/**
* Always returns an empty Optional.
*
* @param serviceName ignored
* @param instanceId ignored
* @return empty Optional
*/
@Override
public Optional findServiceInstanceBy(String serviceName, String instanceId) {
LOG.warn("NoOpRegistryClient#findServiceInstanceBy always returns empty Optional");
return Optional.empty();
}
/**
* Always returns an empty, unmodifiable list.
*
* @param query ignored
* @return empty unmodifiable list
*/
@Override
public List findAllServiceInstancesBy(InstanceQuery query) {
LOG.warn("NoOpRegistryClient#findAllServiceInstancesBy always returns empty List");
return List.of();
}
/**
* Always returns an empty, unmodifiable list.
*
* @return empty unmodifiable list
*/
@Override
public List retrieveAllRegisteredInstances() {
LOG.warn("NoOpRegistryClient#retrieveAllRegisteredInstances always returns empty List");
return List.of();
}
}