Migrating to 1.0
The channels were rebuilt around explicit states, and the defects that came out of that are fixed. Most code compiles unchanged. These are the changes that can matter, in the order they will bite.
An export that throws is not retried by default. An exception that escapes ExportAsync (an unexpected failure, a cancellation, a document that cannot be serialized) used to drop the batch silently on every attempt but the last. The items are now reported on the first exception, through ExportExceptionCallback and ExportMaxRetriesCallback, and are not sent again, because a retry after an unknown failure can index a document twice when it has no id. To retry the exceptions that are safe for your data, set the new BufferOptions.ExportRetryOnException:
options.BufferOptions.ExportRetryOnException = e => e is TimeoutException;
WaitForDrainAsync answers true only when nothing is left. It used to return true while batches still waited behind a running export. It is also truly asynchronous now: it used to block the calling thread for up to the wait before returning its task. Without a maxWait the limit is DrainRequestTimeout times the exports still to run.
A whole request answered with 429 is retried. The channel used to drop the batch. When a page is split by OutboundBufferMaxBytes, only the sub-batch that failed is retried or rejected, and the results of the others stay with their documents. A sub-batch that got no answer at all is reported as rejected, not retried.
CompleteAsync returns false when a channel did not drain. Both sync orchestrators used to go on, deleting old documents or switching aliases, whatever the drain said. DrainAllAsync now returns whether both channels drained.
StartAsync runs once. A second call throws, and a start that failed leaves an orchestrator that says so instead of a NullReferenceException.
TryComplete(error) ends the channel. The inbound loop used to spin at 100% CPU.
- Parameter names changed to match what they override:
ctxiscancellationTokenonWaitToWriteAsync(CancellationToken),eventsiscurrentBufferandconsumedBufferStatisticsisstatisticsonRetryBuffer, and the@eventofRetryEventandRejectEventisitem. Positional calls are not affected; a call that names the parameter is. IncrementalSyncOrchestrator.DrainAllAsyncreturnsTask<bool>instead ofTask.WaitToReadResultis removed: the inbound loop no longer reads through a delay and a result, it is woken by a timer.ResponseItemsBufferedChannelBasehas a new protected virtualAllItemsSucceeded(TResponse),falseby default. Override it when your response carries a summary you can trust, and the channel skips matching items to events when nothing failed.IngestChannelBasedoes, from theerrorsflag of the bulk response.Elastic.Channelsalso targetsnet8.0,net10.0andnet11.0, and the three libraries targetnet11.0. The minimum version of the build is the .NET 11 RC SDK.