aws / aws-sdk-java-v2

The official AWS SDK for Java - Version 2
Apache License 2.0
2.16k stars 840 forks source link

Codegenerate BatchManager API under AsyncClient and Initail Interfaces for BatchManager #5321

Closed joviegas closed 3 months ago

joviegas commented 3 months ago

Motivation and Context

PR similar to https://github.com/aws/aws-sdk-java-v2/pull/2666. But following are considered after design reviews

  1. The BatchManager Implementation will be hand written , thus we donot need codegenrated BatchFunctions and code generated Default batch Manager.
  2. We will proivide batchManager() api only to AsyncClient , since returning completable future for sync Api doesnot make sense for Sync API , instead sync API can directly call send/recieve with custom BatchedRequest in its request.

Modifications

Customization

  "batchManagerSupported": true

Will result in code

  1. Addition of scheduledExecutor similar to that of waiters()
  2. Java code as below
    @Override
    public BatchManagerTestAsyncBatchManager batchManager() {
        return BatchManagerTestAsyncBatchManager.builder().client(this).scheduledExecutor(executorService).build();
    }

Testing

  1. Added Junits
  2. Also tested with SQS , made sure other service not impacted

License

zoewangg commented 3 months ago

Can we use the existing additionalBuilderMethods customization config if we are going to handwrite the sqs batch manager anyway?

https://github.com/aws/aws-sdk-java-v2/blob/master/services/s3/src/main/resources/codegen-resources/customization.config#L291

sonarcloud[bot] commented 3 months ago

Quality Gate Failed Quality Gate failed

Failed conditions
35.6% Coverage on New Code (required ≥ 80%)

See analysis details on SonarCloud

joviegas commented 3 months ago

Can we use the existing additionalBuilderMethods customization config if we are going to handwrite the sqs batch manager anyway?

https://github.com/aws/aws-sdk-java-v2/blob/master/services/s3/src/main/resources/codegen-resources/customization.config#L291

These builder Methods are Static APIs on the Client , where as the BatchManager API are non-static methods which are invoked on the client , where client internally uses "this" to build batch Manager.