[
https://issues.apache.org/jira/browse/CAMEL-7787?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14125383#comment-14125383
]
Franz Forsthofer commented on CAMEL-7787:
-----------------------------------------
The problem that the cached stream has been deleted by a sub-route, does not
only occur in the multi-cast or split case. Here is a simple test example which
shows that:
public class StreamCacheInSubRouteTest extends ContextTestSupport {
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
context.setStreamCaching(true);
context.getStreamCachingStrategy().setEnabled(true);
context.getStreamCachingStrategy().setSpoolDirectory(
"target/camel/cache");
context.getStreamCachingStrategy().setSpoolThreshold(1l);
from("direct:startError")
.to("direct:subroute").to("mock:result");
from("direct:subroute") //
.process(new Processor() {
@Override
public void process(Exchange exchange) throws
Exception {
CachedOutputStream cos = new
CachedOutputStream(exchange);
String s = "Test Message 1";
cos.write(s.getBytes(Charset.forName("UTF-8")));
cos.close();
InputStream is = (InputStream)
cos.newStreamCache();
exchange.getOut().setBody(is);
}
}) //
.to("mock:result_subroute");
}
};
}
@Test
public void test() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedMessageCount(1);
template.sendBody("direct:startError", "<start></start>");
byte[] data = mock.getReceivedExchanges().get(0).getIn()
.getBody(byte[].class);
assertEquals("Test Message 1", new String(data, "UTF-8"));
}
}
You can also find this test class attached.
> Multicast - Should defer UoW done until after the aggregate has been done
> -------------------------------------------------------------------------
>
> Key: CAMEL-7787
> URL: https://issues.apache.org/jira/browse/CAMEL-7787
> Project: Camel
> Issue Type: Improvement
> Components: camel-core, eip
> Reporter: Claus Ibsen
> Assignee: Claus Ibsen
> Fix For: 2.15.0
>
>
> See nabble
> http://camel.465427.n5.nabble.com/Stream-Cache-spool-file-deletion-before-aggregation-in-Multicast-involving-huge-data-tp5756092.html
> In the multicast/splitter we should defer the UoW done to *after* the
> aggregate has been called, as in the nabble example, the stream cache
> overflow to disk would have deleted the file etc.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)