Unable to use move,movefailed and donefilename with consumer template endpoint Uri
Hi, I have gone through lots of regarding the issue and came to know if I use consumer.receiveBody() I can move the file but when I am using it I am getting error like: Exception while consuming the locates file:null :Failed to resolve endpoint: file:///home/... Failed to resolve endpoint: Check the uri if the parameters are spelt correctly and that they are properties of the endpoint. Unknown parameters=[{amp;doneFileName=LOADAVAILBNYM, amp;move=/home/cameldata/processedFiles/${file:onlyname.noext}_${date:now:MMdd}.TXT, amp;moveFailed=/home/cameldata/errorfile}] Here is my function to consume a file from the directory: public void consumeBnymFile(Exchange arg) { String endPointUri="file:{{inbound_home}}/bony?include=.*_BNYM_.*txt&move={{data_home}}/${file:onlyname.noext}_${date:now:MMdd}.TXT&moveFailed={{data_home}}/errorfile&doneFileName=LOADAVAILBNYM"; consumer.start(); while (true) { Object newBody=consumer.receiveBody(endPointUri, 2000); //Exchange ex = consumer.receive(fileUri,2000); String streamName=(String)arg.getIn().getHeader("streamName"); if (newBody != null) { arg.getIn().setBody(newBody); { I greatlty appreciate any help in advance. Thanks. -- View this message in context: http://camel.465427.n5.nabble.com/Unable-to-use-move-movefailed-and-donefilename-with-consumer-template-endpoint-Uri-tp5736913.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Unable to use move,movefailed and donefilename with consumer template endpoint Uri
Hi Read the javadoc of the consumer template, it tells you what to do. On Wed, Aug 7, 2013 at 3:17 PM, skumar wrote: > Hi, > I have gone through lots of regarding the issue and came to know if I > use consumer.receiveBody() I can move the file but when I am using it I am > getting error like: > > Exception while consuming the locates file:null :Failed to resolve endpoint: > file:///home/... Failed to resolve endpoint: > Check the uri if the parameters are spelt correctly and that they are > properties of the endpoint. > Unknown parameters=[{amp;doneFileName=LOADAVAILBNYM, > amp;move=/home/cameldata/processedFiles/${file:onlyname.noext}_${date:now:MMdd}.TXT, > amp;moveFailed=/home/cameldata/errorfile}] > > Here is my function to consume a file from the directory: > public void consumeBnymFile(Exchange arg) { > String > endPointUri="file:{{inbound_home}}/bony?include=.*_BNYM_.*txt&move={{data_home}}/${file:onlyname.noext}_${date:now:MMdd}.TXT&moveFailed={{data_home}}/errorfile&doneFileName=LOADAVAILBNYM"; > consumer.start(); > while (true) { > Object newBody=consumer.receiveBody(endPointUri, 2000); > //Exchange ex = consumer.receive(fileUri,2000); > String streamName=(String)arg.getIn().getHeader("streamName"); > if (newBody != null) { > arg.getIn().setBody(newBody); { > > > I greatlty appreciate any help in advance. > Thanks. > > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Unable-to-use-move-movefailed-and-donefilename-with-consumer-template-endpoint-Uri-tp5736913.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - Red Hat, Inc. Email: cib...@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
Re: Unable to use move,movefailed and donefilename with consumer template endpoint Uri
Claus, I have gone through the section "Timer based polling consumer" at http://camel.apache.org/polling-consumer.html as I am using a timer in my route defnition. I try to follow it but still getting the same error.It seems some thing is wrong with the endpoint itself String endPointUri="file:{{inbound_home}}/bony?include=.*_BNYM_.*txt&move={{data_home}}/${file:onlyname.noext}_${date:now:MMdd}.TXT&moveFailed={{data_home}}/errorfile&doneFileName=LOADAVAILBNYM"; But this endpoint was working when I was using it in xml route defnition with from component. I have just to consume a file from a directory location,read it and shift to another directory based on availability of a trigger file named "LOADAVAILBNYM". So I am not doing any Endpoint inject nor using producer template. Please give some hint is this a write way to do.I don't have much experience with camel and I don't think I have very clear grasping of consumer template. Thanks -- View this message in context: http://camel.465427.n5.nabble.com/Unable-to-use-move-movefailed-and-donefilename-with-consumer-template-endpoint-Uri-tp5736913p5736948.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Unable to use move,movefailed and donefilename with consumer template endpoint Uri
See the javadoc at http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/ConsumerTemplate.html And take a look at the doneUoW method etc. On Wed, Aug 7, 2013 at 9:47 PM, skumar wrote: > Claus, > I have gone through the section "Timer based polling consumer" at > http://camel.apache.org/polling-consumer.html as I am using a timer in my > route defnition. > I try to follow it but still getting the same error.It seems some thing is > wrong with the endpoint itself > > String > endPointUri="file:{{inbound_home}}/bony?include=.*_BNYM_.*txt&move={{data_home}}/${file:onlyname.noext}_${date:now:MMdd}.TXT&moveFailed={{data_home}}/errorfile&doneFileName=LOADAVAILBNYM"; > > But this endpoint was working when I was using it in xml route defnition > with from component. > I have just to consume a file from a directory location,read it and shift to > another directory based on availability of a trigger file named > "LOADAVAILBNYM". > So I am not doing any Endpoint inject nor using producer template. > Please give some hint is this a write way to do.I don't have much experience > with camel and I don't think I have very clear grasping of consumer > template. > Thanks > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Unable-to-use-move-movefailed-and-donefilename-with-consumer-template-endpoint-Uri-tp5736913p5736948.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - Red Hat, Inc. Email: cib...@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
Re: Unable to use move,movefailed and donefilename with consumer template endpoint Uri
Thanks,Claus.I was able to get rid of this bug by placing the endpoint Uri on the camel context inside tags and then get this from the camel header on the java class. Eg. file:${in.header.clientFileDir}?include=.*_BNYM_.*txt &move=${properties:data_home}/${file:onlyname.noext}-${date:now:MMddHHmm}.TXT and on the locatesConsumer class: String endPointUri=ex.getIn().getHeader("comsumerUrl", String.class); consumer.start(); String body=consumer.receiveBody(endPointUri, 2000,String.class); It works fine. I have seen one minor issue for the move file parameter what I was thinking that a copy of the camel File will be created with current timestamps inside the data_home directory but infact a sub-directory is created with the current timestamps and that contain the file(just been processed). Claus,can you help regarding this issue. Regards, Sanjeev -- View this message in context: http://camel.465427.n5.nabble.com/Unable-to-use-move-movefailed-and-donefilename-with-consumer-template-endpoint-Uri-tp5736913p5737202.html Sent from the Camel - Users mailing list archive at Nabble.com.