Hello Camel community, We are currently facing an issue while using Apache Camel split in combination with ZipAggregationStrategy. The temporary ZIP file created in the ZipAggregationStrategy is not being deleted after all messages have been split and processed. This is leading to unnecessary file accumulation as well as security concerns as the file remains unencrypted in file system. Although we can see that the “onComplete” method in ZipAggregationStrategy is already implemented but it seems not to get called at all as we have tried to debug the code, which is, based on our understanding, not an expected behavior. The Behavior is the same in Apache Camel 2.x and 3.x.
Here is an example unit test to reproduce the issue: @Test public void testAggregationOnCompletion() throws Exception { getMockEndpoint("mock:result").expectedMessageCount(3); template.sendBody("direct:start", "<messages><message>a</message><message>b</message><message>c</message></messages>"); assertMockEndpointsSatisfied(); } @Override protected RouteBuilder createRouteBuilder() throws Exception { return new RouteBuilder() { @Override public void configure() throws Exception { from("direct:start") .split(body().tokenizeXML("message", "*"), new ZipAggregationStrategy())) .streaming() .stopOnException() .to("mock:result"); } }; } With the ZipSplitter we have the same results: @Test public void testAggregationOnCompletion() throws Exception { getMockEndpoint("mock:result").expectedMessageCount(1); template.sendBody("direct:start", "message AAAA"); assertMockEndpointsSatisfied(); } @Override protected RouteBuilder createRouteBuilder() throws Exception { return new RouteBuilder() { @Override public void configure() throws Exception { from("direct:start") .marshal().zipFile() .split(new ZipSplitter(), new ZipAggregationStrategy()) .streaming() .stopOnException() .log("Split message: ${body}") .process(exchange -> { String originalFileName = exchange.getIn().getHeader("CamelFileName", String.class); exchange.getIn().setHeader("CamelFileName", "proccessed_" + originalFileName); }) .end() .to("mock:result"); } }; } Any insights or suggestions would be greatly appreciated. Thank you in advance for your help! Best Regards, Soheila Esmaeili Pronouns: She Senior Developer, TI SAP CP INT CPI (SE) SAP SE Dietmar-Hopp-Allee 16, 69190 Walldorf, Germany E: .soheila.esmae...@sap.com<mailto:.soheila.esmae...@sap.com> T: +49 6227 7-46596<tel:%20%20+49%206227%207-67287> [cid:image001.png@01DB4B02.EC69DC20] Pflichtangaben/Mandatory Disclosure Statement: www.sap.com/impressum Diese E-Mail kann Betriebs- oder Geschäftsgeheimnisse oder sonstige vertrauliche Informationen enthalten. Sollten Sie diese E-Mail irrtümlich erhalten haben, ist Ihnen eine Kenntnisnahme des Inhalts, eine Vervielfältigung oder Weitergabe der E-Mail ausdrücklich untersagt. Bitte benachrichtigen Sie uns und vernichten Sie die empfangene E-Mail. Vielen Dank. This e-mail may contain trade secrets or privileged, undisclosed, or otherwise confidential information. If you have received this e-mail in error, you are hereby notified that any review, copying, or distribution of it is strictly prohibited. Please inform us immediately and destroy the original transmittal. Thank you for your cooperation.