public class ElasticsearchWorkProcessor extends Object implements AutoCloseable
ElasticsearchWorks against the Elasticsearch server.
When processing multiple requests, bulk requests will be formed and executed as far as possible.
Requests can be processed synchronously or asynchronously.
In the latter case, incoming requests are added to a queue
via a BatchingSharedElasticsearchWorkOrchestrator and processed in bulks.
| Constructor and Description |
|---|
ElasticsearchWorkProcessor(BuildContext context,
ElasticsearchClient client,
GsonProvider gsonProvider,
ElasticsearchWorkFactory workFactory) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
BarrierElasticsearchWorkOrchestrator |
createNonStreamOrchestrator(String indexName,
boolean refreshAfterWrite)
Return an orchestrator for non-stream background works.
|
<T> CompletableFuture<T> |
executeAsyncUnsafe(ElasticsearchWork<T> work)
Execute a single work asynchronously,
without bulking it with other asynchronous works,
and potentially throwing exceptions (the error handler isn't used).
|
<T> T |
executeSyncUnsafe(ElasticsearchWork<T> work)
Execute a single work synchronously,
potentially throwing exceptions (the error handler isn't used).
|
BarrierElasticsearchWorkOrchestrator |
getStreamOrchestrator()
Return the orchestrator for asynchronous, non-stream background works.
|
public ElasticsearchWorkProcessor(BuildContext context, ElasticsearchClient client, GsonProvider gsonProvider, ElasticsearchWorkFactory workFactory)
public void close()
close in interface AutoCloseablepublic <T> T executeSyncUnsafe(ElasticsearchWork<T> work)
work - The work to be executed.public <T> CompletableFuture<T> executeAsyncUnsafe(ElasticsearchWork<T> work)
work - The work to be executed.public BarrierElasticsearchWorkOrchestrator createNonStreamOrchestrator(String indexName, boolean refreshAfterWrite)
Works submitted in the same changeset will be executed in the given order. Relative execution order between changesets is undefined.
Works submitted to this orchestrator will only be bulked with subsequent works (possibly of a different changeset).
If any work throws an exception, this exception will be passed
to the error handler with an ErrorContext spanning exactly the given works,
and the remaining works will not be executed.
public BarrierElasticsearchWorkOrchestrator getStreamOrchestrator()
Works submitted in the same changeset will be executed in the given order. Relative execution order between changesets is undefined.
Works submitted to this orchestrator will only be bulked with subsequent works from the same changeset or with works from a different changeset.
If any work throws an exception, this exception will be passed
to the error handler with an ErrorContext spanning exactly the given works,
and the remaining works will not be executed.
Copyright © 2006–2017 Hibernate. All rights reserved.