io.reactiverse.elasticsearch.client.AsyncSearchClientImpl 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.client.asyncsearch.AsyncSearchResponse;
import org.elasticsearch.client.asyncsearch.DeleteAsyncSearchRequest;
import org.elasticsearch.client.asyncsearch.GetAsyncSearchRequest;
import org.elasticsearch.client.asyncsearch.SubmitAsyncSearchRequest;
import org.elasticsearch.client.core.AcknowledgedResponse;
import java.io.IOException;
import static java.util.Collections.emptySet;
class AsyncSearchClientImpl implements AsyncSearchClient {
private final Vertx vertx;
private final org.elasticsearch.client.AsyncSearchClient delegate;
AsyncSearchClientImpl(Vertx vertx, org.elasticsearch.client.AsyncSearchClient delegate) {
this.vertx = vertx;
this.delegate = delegate;
}
@Override()
public void submitAsync(SubmitAsyncSearchRequest request, RequestOptions options, Handler> handler) {
Context context = vertx.getOrCreateContext();
delegate.submitAsync(request, options, new ActionListener() {
@Override
public void onResponse(AsyncSearchResponse 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(GetAsyncSearchRequest request, RequestOptions options, Handler> handler) {
Context context = vertx.getOrCreateContext();
delegate.getAsync(request, options, new ActionListener() {
@Override
public void onResponse(AsyncSearchResponse 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 deleteAsync(DeleteAsyncSearchRequest request, RequestOptions options, Handler> handler) {
Context context = vertx.getOrCreateContext();
delegate.deleteAsync(request, options, new ActionListener() {
@Override
public void onResponse(AcknowledgedResponse value) {
context.runOnContext(v -> handler.handle(Future.succeededFuture(value)));
}
@Override
public void onFailure(Exception e) {
context.runOnContext(v -> handler.handle(Future.failedFuture(e)));
}
});
}
}