io.reactiverse.elasticsearch.client.TasksClientImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of elasticsearch-client-rxjava2 Show documentation
Show all versions of elasticsearch-client-rxjava2 Show documentation
Reactiverse Elasticsearch client :: RxJava2 bindings
The 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.list.ListTasksRequest;
import org.elasticsearch.action.admin.cluster.node.tasks.list.ListTasksResponse;
import org.elasticsearch.client.tasks.CancelTasksRequest;
import org.elasticsearch.client.tasks.CancelTasksResponse;
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)));
}
});
}
}