T
- The type of the document that the buffered sender will use.public final class SearchClientBuilder.SearchIndexingBufferedSenderBuilder<T> extends Object
SearchIndexingBufferedSenders
and SearchIndexingBufferedAsyncSenders
. Call SearchClientBuilder.SearchIndexingBufferedSenderBuilder.buildSender()
and SearchClientBuilder.SearchIndexingBufferedSenderBuilder.buildAsyncSender()
respectively to
construct an instance of the desired sender.Modifier and Type | Method and Description |
---|---|
SearchClientBuilder.SearchIndexingBufferedSenderBuilder<T> |
autoFlush(boolean autoFlush)
Sets the flag determining whether a buffered sender will automatically flush its document batch based on the
configurations of
SearchClientBuilder.SearchIndexingBufferedSenderBuilder.autoFlushInterval(Duration) and SearchClientBuilder.SearchIndexingBufferedSenderBuilder.initialBatchActionCount(int) . |
SearchClientBuilder.SearchIndexingBufferedSenderBuilder<T> |
autoFlushInterval(Duration autoFlushInterval)
Sets the duration between a buffered sender sending documents to be indexed.
|
SearchIndexingBufferedAsyncSender<T> |
buildAsyncSender()
Creates a
SearchIndexingBufferedAsyncSender based on options set in the builder. |
SearchIndexingBufferedSender<T> |
buildSender()
Creates a
SearchIndexingBufferedSender based on options set in the builder. |
SearchClientBuilder.SearchIndexingBufferedSenderBuilder<T> |
documentKeyRetriever(Function<T,String> documentKeyRetriever)
Sets the function that retrieves the key value from a document.
|
SearchClientBuilder.SearchIndexingBufferedSenderBuilder<T> |
initialBatchActionCount(int initialBatchActionCount)
Sets the number of documents before a buffered sender will send the batch to be indexed.
|
SearchClientBuilder.SearchIndexingBufferedSenderBuilder<T> |
maxRetriesPerAction(int maxRetriesPerAction)
Sets the number of times an action will retry indexing before it is considered failed.
|
SearchClientBuilder.SearchIndexingBufferedSenderBuilder<T> |
maxThrottlingDelay(Duration maxThrottlingDelay)
Sets the maximum duration that requests will be delayed when the service is throttling.
|
SearchClientBuilder.SearchIndexingBufferedSenderBuilder<T> |
onActionAdded(Consumer<OnActionAddedOptions<T>> onActionAddedConsumer)
Callback hook for when a document indexing action has been added to a batch queued.
|
SearchClientBuilder.SearchIndexingBufferedSenderBuilder<T> |
onActionError(Consumer<OnActionErrorOptions<T>> onActionErrorConsumer)
Sets the callback hook for when a document indexing action has failed to index and isn't retryable.
|
SearchClientBuilder.SearchIndexingBufferedSenderBuilder<T> |
onActionSent(Consumer<OnActionSentOptions<T>> onActionSentConsumer)
Sets the callback hook for when a document indexing has been sent in a batching request.
|
SearchClientBuilder.SearchIndexingBufferedSenderBuilder<T> |
onActionSucceeded(Consumer<OnActionSucceededOptions<T>> onActionSucceededConsumer)
Sets the callback hook for when a document indexing action has successfully completed indexing.
|
SearchClientBuilder.SearchIndexingBufferedSenderBuilder<T> |
throttlingDelay(Duration throttlingDelay)
Sets the initial duration that requests will be delayed when the service is throttling.
|
public SearchIndexingBufferedSender<T> buildSender()
SearchIndexingBufferedSender
based on options set in the builder. Every time this is called
a new instance of SearchIndexingBufferedSender
is created.NullPointerException
- If indexName
, endpoint
, or documentKeyRetriever
are
null.public SearchIndexingBufferedAsyncSender<T> buildAsyncSender()
SearchIndexingBufferedAsyncSender
based on options set in the builder. Every time this is
called a new instance of SearchIndexingBufferedAsyncSender
is created.NullPointerException
- If indexName
, endpoint
, or documentKeyRetriever
are
null.public SearchClientBuilder.SearchIndexingBufferedSenderBuilder<T> autoFlush(boolean autoFlush)
SearchClientBuilder.SearchIndexingBufferedSenderBuilder.autoFlushInterval(Duration)
and SearchClientBuilder.SearchIndexingBufferedSenderBuilder.initialBatchActionCount(int)
.autoFlush
- Flag determining whether a buffered sender will automatically flush.public SearchClientBuilder.SearchIndexingBufferedSenderBuilder<T> autoFlushInterval(Duration autoFlushInterval)
The buffered sender will reset the duration when documents are sent for indexing, either by reaching SearchClientBuilder.SearchIndexingBufferedSenderBuilder.initialBatchActionCount(int)
or by a manual trigger.
If autoFlushInterval
is negative or zero and SearchClientBuilder.SearchIndexingBufferedSenderBuilder.autoFlush(boolean)
is enabled the buffered
sender will only flush when SearchClientBuilder.SearchIndexingBufferedSenderBuilder.initialBatchActionCount(int)
is met.
autoFlushInterval
- Duration between document batches being sent for indexing.NullPointerException
- If autoFlushInterval
is null.public SearchClientBuilder.SearchIndexingBufferedSenderBuilder<T> initialBatchActionCount(int initialBatchActionCount)
This will only trigger a batch to be sent automatically if SearchClientBuilder.SearchIndexingBufferedSenderBuilder.autoFlushInterval
is configured. Default
value is 512
.
initialBatchActionCount
- The number of documents in a batch that will trigger it to be indexed.IllegalArgumentException
- If batchSize
is less than one.public SearchClientBuilder.SearchIndexingBufferedSenderBuilder<T> maxRetriesPerAction(int maxRetriesPerAction)
Documents are only retried on retryable status codes.
Default value is 3
.
maxRetriesPerAction
- The number of times a document will retry indexing before it is considered
failed.IllegalArgumentException
- If maxRetriesPerAction
is less than one.public SearchClientBuilder.SearchIndexingBufferedSenderBuilder<T> throttlingDelay(Duration throttlingDelay)
Default value is Duration.ofMillis(800)
.
throttlingDelay
- The initial duration requests will delay when the service is throttling.IllegalArgumentException
- If throttlingDelay.isNegative()
or throttlingDelay.isZero()
is true.NullPointerException
- If throttlingDelay
is null.public SearchClientBuilder.SearchIndexingBufferedSenderBuilder<T> maxThrottlingDelay(Duration maxThrottlingDelay)
If maxThrottlingDelay
is less than SearchClientBuilder.SearchIndexingBufferedSenderBuilder.throttlingDelay(Duration)
then SearchClientBuilder.SearchIndexingBufferedSenderBuilder.throttlingDelay(Duration)
will be used as the maximum delay.
Default value is Duration.ofMinutes(1)
.
maxThrottlingDelay
- The maximum duration requests will delay when the service is throttling.IllegalArgumentException
- If maxThrottlingDelay.isNegative()
or maxThrottlingDelay.isZero()
is true.NullPointerException
- If maxThrottlingDelay
is null.public SearchClientBuilder.SearchIndexingBufferedSenderBuilder<T> onActionAdded(Consumer<OnActionAddedOptions<T>> onActionAddedConsumer)
onActionAddedConsumer
- The Consumer
that is called when a document has been added to a batch
queue.public SearchClientBuilder.SearchIndexingBufferedSenderBuilder<T> onActionSucceeded(Consumer<OnActionSucceededOptions<T>> onActionSucceededConsumer)
onActionSucceededConsumer
- The Consumer
that is called when a document has been successfully
indexing.public SearchClientBuilder.SearchIndexingBufferedSenderBuilder<T> onActionError(Consumer<OnActionErrorOptions<T>> onActionErrorConsumer)
onActionErrorConsumer
- The Consumer
that is called when a document has failed to index and
isn't retryable.public SearchClientBuilder.SearchIndexingBufferedSenderBuilder<T> onActionSent(Consumer<OnActionSentOptions<T>> onActionSentConsumer)
onActionSentConsumer
- The Consumer
that is called when a document has been sent in a batch
request.public SearchClientBuilder.SearchIndexingBufferedSenderBuilder<T> documentKeyRetriever(Function<T,String> documentKeyRetriever)
documentKeyRetriever
- Function that retrieves the key from an IndexAction
.NullPointerException
- If documentKeyRetriever
is null.Copyright © 2021 Microsoft Corporation. All rights reserved.