Search in sources :

Example 1 with MirrorHost

use of com.bakdata.quick.common.api.model.mirror.MirrorHost in project quick by bakdata.

the class KafkaQueryService method fetch.

private V fetch(final HostInfo replicaHostInfo, final K key) {
    final String host = String.format("%s:%s", replicaHostInfo.host(), replicaHostInfo.port());
    final MirrorHost mirrorHost = new MirrorHost(host, MirrorConfig.directAccess());
    final DefaultMirrorClient<K, V> client = new DefaultMirrorClient<>(mirrorHost, this.client, this.valueResolver.getElementType());
    final V value = client.fetchValue(key);
    if (value == null) {
        throw new NotFoundException("Key not found");
    }
    return value;
}
Also used : MirrorHost(com.bakdata.quick.common.api.model.mirror.MirrorHost) NotFoundException(com.bakdata.quick.common.exception.NotFoundException) DefaultMirrorClient(com.bakdata.quick.common.api.client.DefaultMirrorClient)

Aggregations

DefaultMirrorClient (com.bakdata.quick.common.api.client.DefaultMirrorClient)1 MirrorHost (com.bakdata.quick.common.api.model.mirror.MirrorHost)1 NotFoundException (com.bakdata.quick.common.exception.NotFoundException)1