Andrea Cosentino created CAMEL-26523:
----------------------------------------

             Summary: camel-alibaba-oss - with includeBody=false, closing an 
unread object stream still downloads the rest of the object
                 Key: CAMEL-26523
                 URL: https://issues.apache.org/jira/browse/CAMEL-26523
             Project: Camel
          Issue Type: Improvement
            Reporter: Andrea Cosentino


Follow-up of CAMEL-26261 ([PR 
#28952|https://github.com/apache/camel/pull/28952]), which added 
{{includeBody}} so the consumer can give the object content as a stream.

The SDK stream (alibabacloud-oss-v2) is an {{AbortableInputStream}} over 
HttpCore's {{EofSensorInputStream}}, and {{close()}} reads the rest of the 
object so the connection can be reused. So a route that does not read the body, 
or a consumer that stops in the middle of a poll, still downloads every 
remaining object in full. With the SDK's default HttpClient 5 transport, the 
SDK's {{abort()}} does the same (a local test with a 256 MB object downloaded 
all of it for both {{close()}} and {{abort()}}); only the opt-in HttpClient 4 
transport aborts without reading. The component doc now documents this.

Options: abort for real on HttpClient 5 by unwrapping the stream 
({{AbortableInputStream.unwarp()}}) and calling 
{{EofSensorInputStream.abort()}}, which ties the component to the SDK's 
transport internals; or ask the SDK to make its {{Abortable}} close the 
response with {{CloseMode.IMMEDIATE}} and use {{abort()}} for unread streams 
once it does.

_Claude Code on behalf of Andrea Cosentino (oscerd)_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to