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

Claus Ibsen resolved CAMEL-20998.
---------------------------------
    Resolution: Fixed

> camel-google-storage: objectNames can conflict with each other
> --------------------------------------------------------------
>
>                 Key: CAMEL-20998
>                 URL: https://issues.apache.org/jira/browse/CAMEL-20998
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-google-storage
>    Affects Versions: 3.18.3, 3.22.2, 4.7.0
>            Reporter: Brice Frisco
>            Priority: Major
>             Fix For: 4.8.0
>
>
> When using the Consumer and the Producer within the same route, the 
> {{objectName}} can conflict with each other. Consider the following example:
> {code:java}
> public class MyRouteBuilder extends RouteBuilder {
>     @Override
>     public void configure() {
>         from("timer:test?repeatCount=1")
>                 .pollEnrich("google-storage://{{google.cloud.bucket.name}}" +
>                         "?objectName=hello.txt" +
>                         "&deleteAfterRead=false")
>                 .log("File received with contents: '${body}'")
>                 .setBody(simple("hello2"))
>                 .log("Writing to hello2.txt with body: '${body}'")
>                 
> .to("google-storage://{{google.cloud.bucket.name}}?objectName=hello2.txt");
>     }
> } {code}
> The expectation would be that the file `hello.txt` would be read, and then a 
> separate file `hello2.txt` would be written. However, what actually happens 
> is that the original file `hello.txt` is overwritten.
> *Workaround*
> A workaround is to add {{.removeHeaders("*")}} before writing the new file:
> {code:java}
> .removeHeaders("*")
> .to("google-storage://{{google.cloud.bucket.name}}?objectName=hello2.txt"); 
> {code}
> *Reproducer*
> I have built a simple reproducer and steps to run it here: 
> [https://github.com/bricefrisco/camel-google-storage-bug-reproducer]



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to