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

io.quarkus.redis.client.runtime.RedisClientRecorder Maven / Gradle / Ivy

There is a newer version: 3.17.5
Show newest version
package io.quarkus.redis.client.runtime;

import java.util.function.Supplier;

import io.quarkus.arc.Arc;
import io.quarkus.redis.client.RedisClient;
import io.quarkus.redis.client.reactive.ReactiveRedisClient;
import io.quarkus.runtime.annotations.Recorder;
import io.vertx.redis.client.Redis;
import io.vertx.redis.client.RedisAPI;

@Recorder
public class RedisClientRecorder {

    public Supplier redisClientSupplier(String clientName) {
        return new Supplier() {
            @Override
            public RedisClient get() {
                RedisAPIContainer redisAPIContainer = getRedisAPIContainer(clientName);
                return redisAPIContainer.getRedisClient();
            }
        };
    }

    public Supplier reactiveRedisClientSupplier(String clientName) {
        return new Supplier() {
            @Override
            public ReactiveRedisClient get() {
                RedisAPIContainer redisAPIContainer = getRedisAPIContainer(clientName);
                return redisAPIContainer.getReactiveClient();
            }
        };
    }

    public Supplier mutinyRedisSupplier(String clientName) {
        return new Supplier() {
            @Override
            public MutinyRedis get() {
                RedisAPIContainer redisAPIContainer = getRedisAPIContainer(clientName);
                return redisAPIContainer.getMutinyRedis();
            }
        };
    }

    public Supplier mutinyRedisAPISupplier(String clientName) {
        return new Supplier() {
            @Override
            public MutinyRedisAPI get() {
                RedisAPIContainer redisApiContainer = getRedisAPIContainer(clientName);
                return redisApiContainer.getMutinyRedisAPI();
            }
        };
    }

    public Supplier redisAPISupplier(String clientName) {
        return new Supplier() {
            @Override
            public RedisAPI get() {
                RedisAPIContainer redisAPIContainer = getRedisAPIContainer(clientName);
                return redisAPIContainer.getRedisAPI();
            }
        };
    }

    public Supplier redisSupplier(String clientName) {
        return new Supplier() {
            @Override
            public Redis get() {
                RedisAPIContainer redisAPIContainer = getRedisAPIContainer(clientName);
                return redisAPIContainer.getRedis();
            }
        };
    }

    private RedisAPIContainer getRedisAPIContainer(String clientName) {
        RedisAPIProducer redisAPIProducer = Arc.container().instance(RedisAPIProducer.class).get();
        return redisAPIProducer.getRedisAPIContainer(clientName);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy