echauchot commented on code in PR #19680:
URL: https://github.com/apache/flink/pull/19680#discussion_r877234379
##########
flink-connectors/flink-connector-cassandra/src/main/java/org/apache/flink/batch/connectors/cassandra/CassandraPojoOutputFormat.java:
##########
@@ -90,67 +83,20 @@ public void open(int taskNumber, int numTasks) {
mapper.setDefaultSaveOptions(optionsArray);
}
}
- this.callback =
- new FutureCallback<Void>() {
- @Override
- public void onSuccess(Void ignored) {
- onWriteSuccess();
- }
-
- @Override
- public void onFailure(Throwable t) {
- onWriteFailure(t);
- }
- };
}
@Override
- public void writeRecord(OUT record) throws IOException {
- if (exception != null) {
- throw new IOException("write record failed", exception);
- }
-
- ListenableFuture<Void> result = mapper.saveAsync(record);
- Futures.addCallback(result, callback);
- }
-
- /**
- * Callback that is invoked after a record is written to Cassandra
successfully.
- *
- * <p>Subclass can override to provide its own logic.
- */
- protected void onWriteSuccess() {}
-
- /**
- * Callback that is invoked when failing to write to Cassandra. Current
implementation will
- * record the exception and fail the job upon next record.
- *
- * <p>Subclass can override to provide its own failure handling logic.
- *
- * @param t the exception
- */
- protected void onWriteFailure(Throwable t) {
- exception = t;
+ public ListenableFuture<Void> send(OUT record) {
Review Comment:
:+1:
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]