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. 

>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.

Reply via email to