Is really a big problem, there's no place for logic:) I enabled the trace mode, the Action field is in the header of the message,
I tried another solution, by changing the file name by adding at the end ${header.Action} The result: I get all the files in the directory c:/CAMEL/IN/AAE with a name FileName_PCA.csv or FileName_AAE.csv Conclusion: the filter does not work. Here is the setup I used: <route errorHandlerRef="myDeadLetterChannel"> <from uri="activemq:queue:AX.IN"/> <choice> <when> <simple> $ header.Action () == 'AAE' </ simple> <setHeader headerName="org.apache.camel.file.name"> <constant> $ (file: name.noext ($ _)) header.Action. csv </ constant> </ setHeader> <t uri="file:///c:/CAMEL/IN/AAE"/> </ when> <when> <simple> $ header.Action () == 'PCA' </ simple> <setHeader headerName="org.apache.camel.file.name"> <constant> $ (file: name.noext ($ _)) header.Action. csv </ constant> </ setHeader> <t uri="file:///c:/CAMEL/IN/PCA"/> </ when> <otherwise> <t uri="activemq:queue:FilterError"/> </ otherwise> </ choice> </ route> Claus Ibsen-2 wrote: > > Hi > > Is there a Action header at all? > > You can use the tracer to look? > http://camel.apache.org/tracer > > I suspect this is the problem. > > > On Thu, Oct 8, 2009 at 12:49 PM, titexe <abdellatifbouch...@eurofins.com> > wrote: >> >> Thank you for your reply, >> >> now I get no errors for CSV files. >> >> cons by my filter does not work with the simple language, it puts all >> files >> received in the same directory >> <to uri="file:///c:/CAMEL/IN/AAE"/> >> >> below my configuration: >> >> <route errorHandlerRef="myDeadLetterChannel"> >> <from uri="activemq:queue:AX.IN"/> >> <choice> >> >> <when> >> <simple>${in.header.Action} == >> 'AAE'</simple> >> <to uri="file:///c:/CAMEL/IN/AAE"/> >> </when> >> <when> >> <simple>${in.header.Action} == >> 'PCA'</simple> >> <to uri="file:///c:/CAMEL/IN/PCA"/> >> </when> >> >> <otherwise> >> <to uri="activemq:queue:FilterError"/> >> </otherwise> >> >> </choice> >> </route> >> >> Thank you again for your help. >> >> >> Claus Ibsen-2 wrote: >>> >>> On Thu, Oct 8, 2009 at 11:22 AM, titexe >>> <abdellatifbouch...@eurofins.com> >>> wrote: >>>> >>>> >>>> my incoming queue, receives messages of bytes type. >>>> >>>> the message content in bytes may be an XML or CSV or PDF file that I >>>> converted a file in the end. >>>> >>>> In the header of the message,there's on properties(Action), that allows >>>> me >>>> to place this file to the proper directory. >>>> >>> >>> Ah are you saying its a JMS property that has this value? If so you >>> can route without xpath using the header predicate instead >>> <xpath> $ action = 'AAE' </ xpath> >>> >>> Could then be >>> <simple>${header.action} == 'AAE' </header> >>> >>> Using the simple language to test this >>> http://camel.apache.org/simple.html >>> >>> >>> >>> >>>> From where I put <xpath> $ action = 'AAE' </ xpath> <to >>>> uri="file:///c:/CSV/AAE"/> >>>> >>>> Thank you for helping me find a good solution to my problem >>>> >>>> Thank you again for your help >>>> >>>> >>>> Claus Ibsen-2 wrote: >>>>> >>>>> Hi >>>>> >>>>> Why do you have mixed message on that JMS queue? >>>>> >>>>> Can you not have 1 queue for XML files >>>>> And another queue for CSV files? >>>>> >>>>> If not I suggest to use 3 routes >>>>> >>>>> 1st route will consume from that JMS queue and check the message >>>>> content if its XML or CSV. >>>>> And then route to either A or B depending on that >>>>> >>>>> 2nd route = A which is the XML route where you can use xpath >>>>> >>>>> 3rd route = B which is the CSV route where you use something else than >>>>> xpath. For example a java bean to check the action or what you would >>>>> like to do with the CSV file. >>>>> >>>>> >>>>> On Thu, Oct 8, 2009 at 10:48 AM, titexe >>>>> <abdellatifbouch...@eurofins.com> >>>>> wrote: >>>>>> >>>>>> Firstly, thank you for your reply, >>>>>> >>>>>> Action is a field that exists in the header of the message (Message >>>>>> proportions), normally xpath ($ action = 'AAE') should not parse the >>>>>> message >>>>>> body. >>>>>> >>>>>> if not, it is possible to use another command that allows me to >>>>>> filter >>>>>> the >>>>>> fields in the header of the message without parsing the message body? >>>>>> and >>>>>> it >>>>>> is possible to use it in my case <choice> of my route? >>>>>> >>>>>> Thank you in advance >>>>>> >>>>>> >>>>>> Claus Ibsen-2 wrote: >>>>>>> >>>>>>> Hi >>>>>>> >>>>>>> You are using XPath expressions >>>>>>> <xpath> $ action = 'AAE' </ xpath> >>>>>>> >>>>>>> And they *require* the payload to be XML. >>>>>>> So you cannot use XPath with CSV. >>>>>>> >>>>>>> >>>>>>> On Wed, Oct 7, 2009 at 10:59 AM, titexe >>>>>>> <abdellatifbouch...@eurofins.com> >>>>>>> wrote: >>>>>>>> >>>>>>>> For information >>>>>>>> >>>>>>>> Version Camel = Camel V1.6.1.2 >>>>>>>> Version Activemq = Fuse message broker 5.3.0.3 >>>>>>>> Version Java = V1.6.0_16 >>>>>>>> >>>>>>>> >>>>>>>> titexe wrote: >>>>>>>>> >>>>>>>>> Hello, >>>>>>>>> >>>>>>>>> Here is the description of my route camel : I get a message type >>>>>>>>> Bytes >>>>>>>>> in >>>>>>>>> my queue, I transferred this message to another broker instance in >>>>>>>>> another >>>>>>>>> machine. >>>>>>>>> >>>>>>>>> was receiving this message I transformed this message to CSV or >>>>>>>>> XML >>>>>>>>> file. >>>>>>>>> >>>>>>>>> my problem is that my route works very well for XML files and not >>>>>>>>> for >>>>>>>>> CSV >>>>>>>>> files. >>>>>>>>> >>>>>>>>> Here is my setup: >>>>>>>>> >>>>>>>>> <route errorHandlerRef="myDeadLetterChannel"> >>>>>>>>> <from uri="activemq:queue:IN"/> >>>>>>>>> <choice> >>>>>>>>> <when> >>>>>>>>> <xpath> $ action = 'AAE' </ xpath> >>>>>>>>> <t uri="file:///c:/IN/AAE/"/> >>>>>>>>> <setBody> >>>>>>>>> <simple> UPDATE SET CAMEL CamelDate = CURRENT_TIMESTAMP WHERE >>>>>>>>> message >>>>>>>>> = >>>>>>>>> '$ >>>>>>>>> (in.header.MessageId)' </ simple> >>>>>>>>> </ setBody> >>>>>>>>> <t uri="jdbc:testdb"/> >>>>>>>>> </ when> >>>>>>>>> <when> >>>>>>>>> <xpath> $ action = 'FAE' </ xpath> >>>>>>>>> <t uri="file:///c:/IN/FAE/"/> >>>>>>>>> <setBody> >>>>>>>>> <simple> UPDATE SET CAMEL CamelDate = CURRENT_TIMESTAMP WHERE >>>>>>>>> message >>>>>>>>> = >>>>>>>>> '$ >>>>>>>>> (in.header.MessageId)' </ simple> >>>>>>>>> </ setBody> >>>>>>>>> <t uri="jdbc:testdb"/> >>>>>>>>> </ when> >>>>>>>>> >>>>>>>>> <otherwise> >>>>>>>>> <t uri="activemq:queue:FilterError"/> >>>>>>>>> </ otherwise> >>>>>>>>> >>>>>>>>> </ choice> >>>>>>>>> </ route> >>>>>>>>> >>>>>>>>> >>>>>>>>> Here is the error that I receive when the transformationfor CSV >>>>>>>>> file. >>>>>>>>> >>>>>>>>> >>>>>>>>> WARN EndpointMessageListener - Endpoint [ActiveMQ: tail: IN] >>>>>>>>> consumer >>>>>>>>> caught an exception while processing JMS message: >>>>>>>>> ActiveMQBytesMessage >>>>>>>>> CommandID = (10, responseRequired = false, messageId = ID: >>>>>>>>> DCFR-4099-1254861846625-3: 0:1:1:1, originalDestination = null, >>>>>>>>> originalTransactionId = null, >>>>>>>>> producerId = ID: DCFR-4099-1254861846625-2: 0:1:1, destination = >>>>>>>>> queue: >>>>>>>>> / / IN, transactionId = null, expiration = 0, timestamp = >>>>>>>>> 1254862039687, >>>>>>>>> arrived >>>>>>>>> l = 0, brokerInTime = 1254879861750, brokerOutTime = >>>>>>>>> 1254879861765, >>>>>>>>> CorrelationId = null, ReplyTo = null, persistent = true, type = >>>>>>>>> null, >>>>>>>>> priority = 4 >>>>>>>>> , GroupID = null, groupSequence = 0, targetConsumerId = null, >>>>>>>>> compressed >>>>>>>>> = >>>>>>>>> false, userID = null, content = >>>>>>>>> org.apache.activemq.util.ByteSequence >>>>>>>>> @ >>>>>>>>> 6baf2 >>>>>>>>> 4 marshalledProperties = org.apache.activemq.util.ByteSequence @ >>>>>>>>> 1b7a553, >>>>>>>>> Datastructures = null, redeliveryCounter = 0, size = 2597, >>>>>>>>> properties >>>>>>>>> = >>>>>>>>> (Sourc >>>>>>>>> eEndpoint = null, org_apache_camel_file_name = EUANNA_PCA_20090901 >>>>>>>>> (50e71be4-B408-48b3-9048-4e68faf6cbd3). csv DestinationEndpoint = >>>>>>>>> null, >>>>>>>>> MessageId = (50e71be >>>>>>>>> 4-B408-48b3-9048-4e68faf6cbd3), Action = PCA PartnerCode = EUANNA, >>>>>>>>> SourceEndpointUser = null, RequestMessageId = null), >>>>>>>>> readOnlyProperties >>>>>>>>> = >>>>>>>>> true, readOnlyBo >>>>>>>>> dy = true, droppable = false) (ActiveMQBytesMessage = null >>>>>>>>> bytesOut, >>>>>>>>> dataOut = null, @ DATAIN = java.io.DataInputStream 1d314cc) >>>>>>>>> org.apache.camel.RuntimeCamelException: >>>>>>>>> org.xml.sax.SAXParseException: >>>>>>>>> Content is not allowed in prolog. >>>>>>>>> at org.apache.camel.util.ObjectHelper.invokeMethod >>>>>>>>> (ObjectHelper.java: 567) >>>>>>>>> at >>>>>>>>> org.apache.camel.impl.converter.InstanceMethodTypeConverter.convertTo >>>>>>>>> (InstanceMethodTypeConverter.java: 57) >>>>>>>>> at >>>>>>>>> org.apache.camel.impl.converter.DefaultTypeConverter.doConvertTo >>>>>>>>> (DefaultTypeConverter.java: 119) >>>>>>>>> at >>>>>>>>> org.apache.camel.impl.converter.DefaultTypeConverter.convertTo >>>>>>>>> (DefaultTypeConverter.java: 90) >>>>>>>>> at org.apache.camel.impl.MessageSupport.getBody >>>>>>>>> (MessageSupport.java: 79) >>>>>>>>> at org.apache.camel.impl.MessageSupport.getBody >>>>>>>>> (MessageSupport.java: 52) >>>>>>>>> at org.apache.camel.builder.xml.XPathBuilder.getDocument >>>>>>>>> (XPathBuilder.java: 536) >>>>>>>>> at org.apache.camel.builder.xml.XPathBuilder.evaluateAs >>>>>>>>> (XPathBuilder.java: 428) >>>>>>>>> at org.apache.camel.builder.xml.XPathBuilder.matches >>>>>>>>> (XPathBuilder.java: 106) >>>>>>>>> at org.apache.camel.builder.xml.XPathBuilder.matches >>>>>>>>> (XPathBuilder.java: 65) >>>>>>>>> at org.apache.camel.processor.ChoiceProcessor.process >>>>>>>>> (ChoiceProcessor.java: 47) >>>>>>>>> at >>>>>>>>> org.apache.camel.management.InstrumentationProcessor.process >>>>>>>>> (InstrumentationProcessor.java: 80) >>>>>>>>> >>>>>>>>> Thank you for helping me resolve this problem, >>>>>>>>> >>>>>>>>> Thank you in advance, >>>>>>>>> >>>>>>>>> best regards, >>>>>>>>> >>>>>>>>> titexe >>>>>>>>> >>>>>>>> >>>>>>>> -- >>>>>>>> View this message in context: >>>>>>>> http://www.nabble.com/Camel-%3A-Error-Message-to-CSV-file-tp25781902p25782958.html >>>>>>>> Sent from the Camel - Users mailing list archive at Nabble.com. >>>>>>>> >>>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> -- >>>>>>> Claus Ibsen >>>>>>> Apache Camel Committer >>>>>>> >>>>>>> Open Source Integration: http://fusesource.com >>>>>>> Blog: http://davsclaus.blogspot.com/ >>>>>>> Twitter: http://twitter.com/davsclaus >>>>>>> >>>>>>> >>>>>> >>>>>> -- >>>>>> View this message in context: >>>>>> http://www.nabble.com/Camel-%3A-Error-Message-to-CSV-file-tp25781902p25800470.html >>>>>> Sent from the Camel - Users mailing list archive at Nabble.com. >>>>>> >>>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> Claus Ibsen >>>>> Apache Camel Committer >>>>> >>>>> Open Source Integration: http://fusesource.com >>>>> Blog: http://davsclaus.blogspot.com/ >>>>> Twitter: http://twitter.com/davsclaus >>>>> >>>>> >>>> >>>> -- >>>> View this message in context: >>>> http://www.nabble.com/Camel-%3A-Error-Message-to-CSV-file-tp25781902p25800861.html >>>> Sent from the Camel - Users mailing list archive at Nabble.com. >>>> >>>> >>> >>> >>> >>> -- >>> Claus Ibsen >>> Apache Camel Committer >>> >>> Open Source Integration: http://fusesource.com >>> Blog: http://davsclaus.blogspot.com/ >>> Twitter: http://twitter.com/davsclaus >>> >>> >> >> -- >> View this message in context: >> http://www.nabble.com/Camel-%3A-Error-Message-to-CSV-file-tp25781902p25801802.html >> Sent from the Camel - Users mailing list archive at Nabble.com. >> >> > > > > -- > Claus Ibsen > Apache Camel Committer > > Open Source Integration: http://fusesource.com > Blog: http://davsclaus.blogspot.com/ > Twitter: http://twitter.com/davsclaus > > -- View this message in context: http://www.nabble.com/Camel-%3A-Error-Message-to-CSV-file-tp25781902p25802968.html Sent from the Camel - Users mailing list archive at Nabble.com.