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

io.quarkus.redis.runtime.datasource.AbstractTransactionalCommands Maven / Gradle / Ivy

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

import io.quarkus.redis.datasource.ReactiveTransactionalRedisCommands;
import io.quarkus.redis.datasource.transactions.ReactiveTransactionalRedisDataSource;
import io.vertx.mutiny.redis.client.Response;

public class AbstractTransactionalCommands implements ReactiveTransactionalRedisCommands {

    protected final TransactionHolder tx;
    private final ReactiveTransactionalRedisDataSource ds;

    public AbstractTransactionalCommands(ReactiveTransactionalRedisDataSource ds, TransactionHolder tx) {
        this.ds = ds;
        this.tx = tx;
    }

    protected void queuedOrDiscard(Response response) {
        if (!"QUEUED".equals(response.toString())) {
            this.tx.discard();
            throw new IllegalStateException("Unable to add command to the current transaction");
        }
    }

    @Override
    public ReactiveTransactionalRedisDataSource getDataSource() {
        return ds;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy