Skip to content
This repository has been archived by the owner on Jan 21, 2022. It is now read-only.

file_name and file_orginalFile as a header is not found in file-source #9

Closed
brijesh1100 opened this issue Mar 8, 2018 · 9 comments
Assignees

Comments

@brijesh1100
Copy link

I am using file-source with s3 sink, I want to use this header to upload the file to S3 with the same name.
I can see a few headers (like Content-Type, id and timestamp) but file_name in header is not found.
I was assigning the key-expression = "headers['file_name']" but I get an error message that such header does not exist.
Can you tell me what is the issue, as I can see in this doc https://github.com/spring-cloud-stream-app-starters/file/tree/master/spring-cloud-starter-stream-source-file
if we take mode as
mode = contents
Headers should come these:
Content-Type: application/octet-stream
file_orginalFile: <java.io.File>
file_name: <file name>

@brijesh1100
Copy link
Author

brijesh1100 commented Mar 8, 2018

@sobychacko , @artembilan

@artembilan artembilan self-assigned this Mar 8, 2018
@artembilan
Copy link
Contributor

The file_orginalFile is a typo. Must be file_originalFile - exactly what we have with the FileHeaders.ORIGINAL_FILE constant. Must be fixed. I did similar fix yesterday for the SFTP source: spring-attic/sftp@bb4cf17

The FileReadingMessageSource has started to populate those headers from Spring Integration 5.0: https://jira.spring.io/browse/INT-832. So, yes, that README is misleading a bit.

Unfortunately I don't see any workaround for the current state, unless you copy/paste the FileSourceConfiguration content to your own class and extend a fileSourceFlow() to the .enrcichHeaders().

Meanwhile I'm fixing the master for SCSt 2.0...

@brijesh1100
Copy link
Author

Thanks @artembilan,
what about file_name this is also not coming in headers any luck we can do this fix.
my main concern is I have to extract file_name from headers, so please tell me any work around regarding so I can add in my code.

@artembilan
Copy link
Contributor

As I said: the only one workaround I see is like code your own Source and populate such a header manually downstream already after FileReadingMessageSource. And only after that send the message with content and appropriate header to the target destination.

@brijesh1100
Copy link
Author

sure @artembilan will do

artembilan added a commit to artembilan/file that referenced this issue Mar 8, 2018
Fixes spring-attic#9

* Refactor code according the latest dependencies
* Fix typos in the README
* Regenerate READMEs according the latest properties
* Verify the `FileHeaders` come with the output message
* Remove test for the `markersJson = false` - non-relevant any more
@artembilan
Copy link
Contributor

The Pull Request for this issue provides a test-case when we verify that mentioned headers already come with the output message.
When it will be merged and you are able to switch to the 2.0 version for SCSt, you'll get requested functionality for free.

@gslulu
Copy link

gslulu commented Apr 30, 2018

Does the integration on Mar 22 mean that file_name, file_orginalFile, and Content-Type are available in the latest SNAPSHOT? I still can't see it working.

The versions I'm using:
spring-cloud-dataflow-server-local-1.4.0.RELEASE.jar
file-source-rabbit-1.3.1.BUILD-SNAPSHOT

@artembilan
Copy link
Contributor

No, you have to use file-source-rabbit-2.0.0.RELEASE.
Please, read comments here carefully.

@gslulu
Copy link

gslulu commented May 1, 2018

Sorry, for your quick response.
I was confused because the scs app starter home page (https://cloud.spring.io/spring-cloud-stream-app-starters/) listed 1.3.1 as the latest snapshot release. I'm good now. Thank You.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

4 participants