Skip to content

Feature request: simplify BatchProcessor by merging async and sync processing functions into one class #1680

Closed as not planned
@am29d

Description

@am29d

Use case

During the implementation of the Batch utility we heavily leaned into the Powertools python implementation and create two classes AsyncBatchProcessor and BatchProcessor. After the refactoring in #1677 we realised that we can implement process and processSync functions in one class.

Solution/User Experience

Create one class with two method for async processing as default and sync processing with sync suffix:

class BatchProcessor extends BasePartialBatchProcessor {
  public async processRecord(
    record: BaseRecord
  ): Promise<SuccessResponse | FailureResponse> {
 
  }

  /**
   * Process a record with instance's handler
   * @param _record Batch record to be processed
   * @returns response of success or failure
   */
  public processRecordSync(
    _record: BaseRecord
  ): SuccessResponse | FailureResponse {
  }
}

Alternative solutions

No response

Acknowledgment

Future readers

Please react with 👍 and your use case to help us understand customer demand.

Metadata

Metadata

Assignees

Labels

batchThis item relates to the Batch Processing Utilityfeature-requestThis item refers to a feature request for an existing or new utilityrejectedThis is something we will not be working on. At least, not in the measurable future

Type

No type

Projects

Status

Closed

Relationships

None yet

Development

No branches or pull requests

Issue actions