All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.kiwiproject.registry.client.NoOpRegistryClient Maven / Gradle / Ivy

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();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy