camel again, csv bindy and file2 EIP

camel as a good EIP, best as far as i know, while i really only know few.

I am working on csv bindy recently for a project, to consume FTP csv file, and parse/marshal to java object then publish to MQ. camel is making EIP very very easy.

Just one point to put, which not so easy to locate through tons of internet information we googled:
crlf (the carriage return) is default to windows, and I think we need to change it to Unix for unix environment application.( Even though I guess it might work in either environment configuration. )

To make things slightly complex, if we wanna use camel default EIP functions, move, preMove and errorMove to handle archiving, inProgress and error handling, then be careful of the file name if you are going to change it.

For example, if we plan to change the file name, by appending the timestamp, make sure we don’t change the file extension. instead of

moveFailed=/error/${file:name}.${date:now:yyyyMMddHHmmssSSS} 

better use,

moveFailed=/error/${file:name.noext}-${date:now:yyyyMMddHHmmssSSS}.${file:ext}

.
thats what exactly happen for me, which camel always throw “No records found in CSV file” exception, as I have put

skipFirstLine= true

, and seems camel then confused because of file extension, and can’t recognize the crlf (carriage return).

http://camel.apache.org/file2.html

http://camel.apache.org/bindy.html

Advertisements

to use simple expression (dynamic) in camel to uri, or routeDefinition

http://camel.apache.org/how-do-i-use-dynamic-uri-in-to.html

seems like

recipientList(simple("freemarker://templateHome/${body.templateName}.ftl"))

is the only way to use expression in recipient endpoint.