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

io.reactiverse.elasticsearch.client.TasksClientImpl Maven / Gradle / Ivy

There is a newer version: 0.9.0-ec7.10.1
Show newest version
/*
[NOTE] This is an automatically generated file.
       Do not make changes to this file but to the shim code generator.

*/
package io.reactiverse.elasticsearch.client;

import io.vertx.core.*;
import org.elasticsearch.client.*;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.admin.cluster.node.tasks.cancel.CancelTasksRequest;
import org.elasticsearch.action.admin.cluster.node.tasks.cancel.CancelTasksResponse;
import org.elasticsearch.action.admin.cluster.node.tasks.list.ListTasksRequest;
import org.elasticsearch.action.admin.cluster.node.tasks.list.ListTasksResponse;
import org.elasticsearch.client.tasks.GetTaskRequest;
import org.elasticsearch.client.tasks.GetTaskResponse;
import java.io.IOException;
import java.util.Optional;
import static java.util.Collections.emptySet;

class TasksClientImpl implements TasksClient {

    private final Vertx vertx;

    private final org.elasticsearch.client.TasksClient delegate;

    TasksClientImpl(Vertx vertx, org.elasticsearch.client.TasksClient delegate) {
        this.vertx = vertx;
        this.delegate = delegate;
    }

    @Override()
    public void listAsync(ListTasksRequest request, RequestOptions options, Handler> handler) {
        Context context = vertx.getOrCreateContext();
        delegate.listAsync(request, options, new ActionListener() {

            @Override
            public void onResponse(ListTasksResponse value) {
                context.runOnContext(v -> handler.handle(Future.succeededFuture(value)));
            }

            @Override
            public void onFailure(Exception e) {
                context.runOnContext(v -> handler.handle(Future.failedFuture(e)));
            }
        });
    }

    @Override()
    public void getAsync(GetTaskRequest request, RequestOptions options, Handler>> handler) {
        Context context = vertx.getOrCreateContext();
        delegate.getAsync(request, options, new ActionListener>() {

            @Override
            public void onResponse(Optional value) {
                context.runOnContext(v -> handler.handle(Future.succeededFuture(value)));
            }

            @Override
            public void onFailure(Exception e) {
                context.runOnContext(v -> handler.handle(Future.failedFuture(e)));
            }
        });
    }

    @Override()
    public void cancelAsync(CancelTasksRequest cancelTasksRequest, RequestOptions options, Handler> handler) {
        Context context = vertx.getOrCreateContext();
        delegate.cancelAsync(cancelTasksRequest, options, new ActionListener() {

            @Override
            public void onResponse(CancelTasksResponse value) {
                context.runOnContext(v -> handler.handle(Future.succeededFuture(value)));
            }

            @Override
            public void onFailure(Exception e) {
                context.runOnContext(v -> handler.handle(Future.failedFuture(e)));
            }
        });
    }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy