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

com.eventstore.dbclient.RestartProjectionSubsystem Maven / Gradle / Ivy

package com.eventstore.dbclient;

import com.eventstore.dbclient.proto.projections.ProjectionsGrpc;
import com.eventstore.dbclient.proto.shared.Shared;
import io.grpc.Metadata;
import io.grpc.stub.MetadataUtils;

import java.util.concurrent.CompletableFuture;

class RestartProjectionSubsystem {
    private final GrpcClient client;
    private final RestartProjectionSubsystemOptions options;

    public RestartProjectionSubsystem(final GrpcClient client, final RestartProjectionSubsystemOptions options) {
        this.client = client;
        this.options = options;
    }

    public CompletableFuture execute() {
        return this.client.run(channel -> {
            ProjectionsGrpc.ProjectionsStub client =
                    GrpcUtils.configureStub(ProjectionsGrpc.newStub(channel), this.client.getSettings(), this.options);

            CompletableFuture result = new CompletableFuture<>();

            Shared.Empty request = Shared.Empty.newBuilder().build();

            client.restartSubsystem(request, GrpcUtils.convertSingleResponse(result));

            return result;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy