Camel 4 intermittently duplicate response

I am doing migration project from Camel 3 to Camel 4.0.0 with Apache 2.4

one of router seems to be weird -> sometimes it duplicates json response for POST response
e.g. expected {"a":"b"} but it shows as {"a":"b"}{"a":"b"}

from(START)
    .process(xxxx) // validating request 
    .to(fffff) // calls other internal service
    .when() // if some condition is met with above 
    .to(yyyy) // calls the other internal service to update value and extract the object {"a":"b"}
    .to(CONVERT_JSON) // response obj to be converted to String
    .process(zzzzz) // preparing logging object
    .to(ExchangePattern.InOnly, ppppp) // write logs 

    // the is whole process for the POST request

Actually “.to(ExchangePattern.InOnly, ppppp)” is only modified area for migration

So I am expecting only {"a":"b"} would be printed through all log printing

However, when I logged with interim body on ‘.to(CONVERT_JSON)’ and ‘the end of the route’. It shows as {"a":"b"} and rarely(only one time) it shows {"a":"b"}{"a":"b"} in the end of the route.

However most of times, only {"a":"b"} is printed in logs, however response shows {"a":"b"}{"a":"b"} in the web browser network tabs

For more investigation, I have used dumpio between Apache 2.4 and Java with proxy setup

request :

dumpio_in data-TRANSIENT
dumpio_out data-heap

response :

dumpio_in : data-heap {"a":"b"}
dumpio_out : data-TRANSIENT {"a":"b"}
dumpio_in : data-heap {"a":"b"}
dumpio_out : data-TRANSIENT {"a":"b"}

even I did tcpdump between two points,

it shows {"a":"b"}, however the response from web browser using network tabs shows {"a":"b"}{"a":"b"}

Expected :
no duplications on printing response

Leave a Comment