awslabs/eventbridge-kafka-connector

refactor `EventBridgeWriter`

agebhar1 opened this issue · 2 comments

What is your idea?

As discussed in #26 a dedicated issue/PR for refactoring EventBridgeWriter#putItems method signature. The suggestion from @maschnetwork:

  1. EventBridgeWriter will accept a Collection of SinkRecords rather than EventBridgeWriterRecords.
public EventBridgeWriterResult putItems(List<SinkRecord> records)
  1. The return type of this method should be a new class EventBridgeWriterResult containing a) List successfulRecords b) List errorRecords, which can be just the current EventBridgeWriterRecord renamed to EventBridgeWriterErrorRecord. Instead of having this class mutable the error code and status should be accepted in the constructor.
public EventBridgeWriterErrorRecord(SinkRecord sinkRecord, String errorCode, String errorMessage) {
    this.record = sinkRecord;
    this.errorCode = errorCode;
    this.errorMessage = errorMessage;
  }

Would you be willing to make the change?

Yes.

Additional context

I've started to refactor the code @maschnetwork, @embano1. Some parts will be refined soon, test cases will be added and Java Doc will be updated as well.