Hi, recently we stumbled across a problem using camel’s “toD” (To-Dynamic) processor in combination with file and https endpoints. Sometimes the component-part of the uri seems to get doubled (e.g. file://file://) which leads to writing the files to the wrong directory (below file:/). We experienced the same issue with toD in combination with https which led to https://https:// and therefore to UnknownHostExceptions.
We think this has to do with the optimization (allowOptimizedComponents) that is done by Camel. As workaround we switched from “toD” to “to” and using the component-specific exchange headers to implement the same behaviour as with “toD”. We know that “toD” optimization can also be disabled, but we think that there is a bug (maybe somewhere in the SendDynamicAware classes for file and http component) and have a bad feeling right now using it. Unfortunately, the issue (especially for file) was not really reproducible and it only happened in one out of three instances of the running service. Here is some output of the FileProducer when the problem happened (you can see the wrongly prepended file:/ on the written file): {"service":"sampleService","timestamp":"2021-10-05T11:42:45.998+02:00","logger":"org.apache.camel.component.file.GenericFileProducer","level":"DEBUG","thread":"Camel (sampleService) thread #13 - JmsConsumer[foo.bar]","msg":"Wrote [file:/tmp/xyz/foo.xml] to [file://file:///tmp/xyz?fileExist=Fail&fileName=%24%7BexchangeProperty.fileLocation.fileName%7D]"} We found a JIRA-Ticket which seems to be related to the problem (https://issues.apache.org/jira/browse/CAMEL-16216) for http-component. With this simple route you can see that toD optimization seems to wrongly extract the “host” part and doubles the http component-part when doing optimization: from(timer("foo").repeatCount(1).delay(1000)).id("sample") .setHeader("timeout", constant(1000)) .toD("http:test.dyn?socketTimeout=${header.timeout}"); [mel-1) thread #0 - timer://foo] SendDynamicProcessor DEBUG Optimising toD via SendDynamicAware component: http to use static uri: http:http:test.dyn We used Camel version 3.11.1 in combination with spring-boot 2.5.3. Has someone experienced similar issues and could some of the camel developers look into this potential bug? Thanks, Nico ________________________________ dmTECH GmbH Am dm-Platz 1, 76227 Karlsruhe * Postfach 10 02 34, 76232 Karlsruhe Telefon 0721 5592-2500 Telefax 0721 5592-2777 dmt...@dm.de<mailto:dmt...@dm.de> * www.dmTECH.de<http://www.dmtech.de> GmbH: Sitz Karlsruhe, Registergericht Mannheim, HRB 104927 Geschäftsführer: Christoph Werner, Martin Dallmeier, Roman Melcher ________________________________ Datenschutzrechtliche Informationen Wenn Sie mit uns in Kontakt treten, beispielsweise wenn Sie an unser ServiceCenter Fragen haben, bei uns einkaufen oder unser dialogicum in Karlsruhe besuchen, mit uns in einer geschäftlichen Verbindung stehen oder sich bei uns bewerben, verarbeiten wir personenbezogene Daten. Informationen unter anderem zu den konkreten Datenverarbeitungen, Löschfristen, Ihren Rechten sowie die Kontaktdaten unserer Datenschutzbeauftragten finden Sie hier<https://www.dm.de/datenschutzerklaerung-kommunikation-mit-externen-493832>.
smime.p7s
Description: S/MIME cryptographic signature