Called when stopping to process one partition of new data in the executor side.
Called when stopping to process one partition of new data in the executor side. This is
guaranteed to be called either open
returns true
or false
. However,
close
won't be called in the following cases:
Throwable
open
throws a Throwable
.
the error thrown during processing data or null if there was no error.
Called when starting to process one partition of new data in the executor.
Called when starting to process one partition of new data in the executor. The version
is
for data deduplication when there are failures. When recovering from a failure, some data may
be generated multiple times but they will always have the same version.
If this method finds using the partitionId
and version
that this partition has already been
processed, it can return false
to skip the further data processing. However, close
still
will be called for cleaning up resources.
the partition id.
a unique id for data deduplication.
true
if the corresponding partition and version id should be processed. false
indicates the partition should be skipped.
Called to process the data in the executor side.
Called to process the data in the executor side. This method will be called only when open
returns true
.
:: Experimental :: A class to consume data generated by a
StreamingQuery
. Typically this is used to send the generated data to external systems. Each partition will use a new deserialized instance, so you usually should do all the initialization (e.g. opening a connection or initiating a transaction) in theopen
method.Scala example:
Java example:
2.0.0