camel s3 consumer filename

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

camel s3 consumer filename

Axel Bock
hi list, since you (read: andrea ;) helped a lot on my last question, I
have another one. I consume files from s3. but the files are saved under
generic file names in my target directory, which I don't want. I actually
want to save them under the name they have in s3.

this is my config (broken up and without &s ...):

<from uri="aws-s3://BUCKET?prefix=my/prefix
    region=EU_CENTRAL_1
    deleteAfterRead=true
    accessKey=RAW(something)
    secretKey=RAW(something)"
/>
<to uri="file:live_test_in" />


... and those are the undesirable file names:

$ ll live_test_in
-rw-r--r-- 1 tm staff 0 Apr 24 18:10
ID-MacBock-Pro-2-fritz-box-1587744607230-0-1
-rw-r--r-- 1 tm staff 0 Apr 24 18:10
ID-MacBock-Pro-2-fritz-box-1587744607230-0-2
-rw-r--r-- 1 tm staff 0 Apr 24 18:10
ID-MacBock-Pro-2-fritz-box-1587744607230-0-3
-rw-r--r-- 1 tm staff 0 Apr 24 18:10
ID-MacBock-Pro-2-fritz-box-1587744607230-0-4


annoying. any help here? greatly appreciated :)
cheers,
axel.
Reply | Threaded
Open this post in threaded view
|

Re: camel s3 consumer filename

Andrea Cosentino-3
When you're consuming file from S3, the name is set in the
header CamelAwsS3Key

So you could do something like

<from uri="aws-s3://BUCKET?prefix=my/prefix
    region=EU_CENTRAL_1
    deleteAfterRead=true
    accessKey=RAW(something)
    secretKey=RAW(something)"
/>
<to uri="file:live_test_in?filename="${header.CamelAwsS3Key} />

I didn't test this.

Il giorno lun 27 apr 2020 alle ore 14:34 Axel Bock <
[hidden email]> ha scritto:

> hi list, since you (read: andrea ;) helped a lot on my last question, I
> have another one. I consume files from s3. but the files are saved under
> generic file names in my target directory, which I don't want. I actually
> want to save them under the name they have in s3.
>
> this is my config (broken up and without &amp;s ...):
>
> <from uri="aws-s3://BUCKET?prefix=my/prefix
>     region=EU_CENTRAL_1
>     deleteAfterRead=true
>     accessKey=RAW(something)
>     secretKey=RAW(something)"
> />
> <to uri="file:live_test_in" />
>
>
> ... and those are the undesirable file names:
>
> $ ll live_test_in
> -rw-r--r-- 1 tm staff 0 Apr 24 18:10
> ID-MacBock-Pro-2-fritz-box-1587744607230-0-1
> -rw-r--r-- 1 tm staff 0 Apr 24 18:10
> ID-MacBock-Pro-2-fritz-box-1587744607230-0-2
> -rw-r--r-- 1 tm staff 0 Apr 24 18:10
> ID-MacBock-Pro-2-fritz-box-1587744607230-0-3
> -rw-r--r-- 1 tm staff 0 Apr 24 18:10
> ID-MacBock-Pro-2-fritz-box-1587744607230-0-4
>
>
> annoying. any help here? greatly appreciated :)
> cheers,
> axel.
>
Reply | Threaded
Open this post in threaded view
|

Re: camel s3 consumer filename

Andrea Cosentino-3
Let me correct myself, it's

<from uri="aws-s3://BUCKET?prefix=my/prefix
    region=EU_CENTRAL_1
    deleteAfterRead=true
    accessKey=RAW(something)
    secretKey=RAW(something)"
/>
<toD uri="file:live_test_in?filename="${header.CamelAwsS3Key} />

Il giorno lun 27 apr 2020 alle ore 15:11 Andrea Cosentino <[hidden email]>
ha scritto:

> When you're consuming file from S3, the name is set in the
> header CamelAwsS3Key
>
> So you could do something like
>
> <from uri="aws-s3://BUCKET?prefix=my/prefix
>     region=EU_CENTRAL_1
>     deleteAfterRead=true
>     accessKey=RAW(something)
>     secretKey=RAW(something)"
> />
> <to uri="file:live_test_in?filename="${header.CamelAwsS3Key} />
>
> I didn't test this.
>
> Il giorno lun 27 apr 2020 alle ore 14:34 Axel Bock <
> [hidden email]> ha scritto:
>
>> hi list, since you (read: andrea ;) helped a lot on my last question, I
>> have another one. I consume files from s3. but the files are saved under
>> generic file names in my target directory, which I don't want. I actually
>> want to save them under the name they have in s3.
>>
>> this is my config (broken up and without &amp;s ...):
>>
>> <from uri="aws-s3://BUCKET?prefix=my/prefix
>>     region=EU_CENTRAL_1
>>     deleteAfterRead=true
>>     accessKey=RAW(something)
>>     secretKey=RAW(something)"
>> />
>> <to uri="file:live_test_in" />
>>
>>
>> ... and those are the undesirable file names:
>>
>> $ ll live_test_in
>> -rw-r--r-- 1 tm staff 0 Apr 24 18:10
>> ID-MacBock-Pro-2-fritz-box-1587744607230-0-1
>> -rw-r--r-- 1 tm staff 0 Apr 24 18:10
>> ID-MacBock-Pro-2-fritz-box-1587744607230-0-2
>> -rw-r--r-- 1 tm staff 0 Apr 24 18:10
>> ID-MacBock-Pro-2-fritz-box-1587744607230-0-3
>> -rw-r--r-- 1 tm staff 0 Apr 24 18:10
>> ID-MacBock-Pro-2-fritz-box-1587744607230-0-4
>>
>>
>> annoying. any help here? greatly appreciated :)
>> cheers,
>> axel.
>>
>