danielcweeks commented on PR #8091:
URL: https://github.com/apache/iceberg/pull/8091#issuecomment-1647189146

   @jackye1995 I think we can avoid having to refactor the HTTPClient by just 
exposing an `ExecChainHandler` that forwards the call to the lambda.  The way 
this works is to just have the HTTPClient add this as the last step in the 
execution chain:
   
   ```
   clientBuilder.addExecInterceptorLast("aws-lambda", execChainHandler);
   ```
   
   The handler just needs to return as opposed to forward on to the rest of the 
chain:
   
   ```
   @Override
   public ClassicHttpResponse execute(ClassicHttpRequest request, 
ExecChain.Scope scope, ExecChain chain) throws IOException, HttpException {
     <make call to lambda and get resulting body>
   
     BasicClassicHttpResponse response = new 
BasicClassicHttpResponse(statusCode);
     response.setEntity(lambdaEntity);
     return response;
   }
   ```
   
   This interrupts the execution chain and returns the result.  We can 
dynamically load the logic for the lambda execution in the same was that we do 
for the SigV4 signer, which keeps all the logic out of the core module.


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to