You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2021/09/10 06:18:00 UTC

[jira] [Resolved] (CAMEL-16924) After upgrade to Camel 3.11.0. Cannot write to HttpServletResponse when aggregator is used.

     [ https://issues.apache.org/jira/browse/CAMEL-16924?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen resolved CAMEL-16924.
---------------------------------
    Resolution: Not A Bug

Information posted on the mailing list

> After upgrade to Camel 3.11.0. Cannot write to HttpServletResponse when aggregator is used.
> -------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-16924
>                 URL: https://issues.apache.org/jira/browse/CAMEL-16924
>             Project: Camel
>          Issue Type: Bug
>    Affects Versions: 3.11.1, 3.11.0
>            Reporter: Jan Vondrouš
>            Priority: Major
>             Fix For: 3.11.3, 3.12.0
>
>
> To easily reproduce issue. We have created this mini repo:
> [https://github.com/bugs84/springboot-camel-httpoutput-issue/tree/camel-minimal-sample]
> Description is in README.md
>  
> h2. Issue description:
> We are experiencing issue in our project after upgrading Apache Camel from version 3.10.0 to 3.11.0 (3.11.1 has the same issue). The same route which worked without any problems in previous versions, does not work now. We managed to simplify the route from our project and simulate the problem on this simplified route.
>  
> {code:java}
> String synchronizerEndpoint = "direct:synchronizer";
> String httpOutputEndpoint = "direct:httpOutput";
> // HTTP Input
> from("servlet:///httpIssue?httpMethodRestrict=GET&servletName=CamelServlet")
>         .log("Http request received")
>         .process(new CorrelationIdGenerator())
>         .to(synchronizerEndpoint);
> // Parallel Synchronizer
> from(synchronizerEndpoint)
>         .log("Parallel Synchronizer")
>         .setHeader("scaler-sync-correlation", correlationExpression)
>         .aggregate(correlationExpression, new MyRoutesAggregator())
>         .completionSize(1)
>         .to(httpOutputEndpoint);
> // HTTP Output
> from(httpOutputEndpoint)
>         .log("HTTP Output")
>         .process(new ProcessHttpOutput());
> {code}
>  n {{ProcessHttpOutput}} processor we are writing the response into the OutputStream:
> {code:java}
> private static class ProcessHttpOutput implements Processor {
>     @Override
>     public void process(Exchange exchange) throws Exception {
>         HttpServletResponse response = exchange.getMessage().getBody(HttpMessage.class).getResponse();
>         response.setStatus(200);
>         try (ServletOutputStream outputStream = response.getOutputStream()) {
>             outputStream.write(("Response").getBytes(StandardCharsets.UTF_8));
>             outputStream.flush();
>         }
>     }
> }
> {code}
> If we run this route on Camel version 3.11.0. We are getting NullPointerException during flushing / closing the stream. It works without any problems on 3.10.0.
> The problem is if *aggregation* is in the route (without aggregation it works fine). After aggregation, it is not possible to write to the output stream.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)