You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by preben <pr...@dr.dk> on 2011/06/03 08:53:09 UTC

CamelFileName over JMS - Bug or working as designed ?

Hi

I'm sending a file over JMS using Oracle AQ.

InRoute
               <camel:route id="demoRoute">
			<camel:from uri="file:/data/indata"/>
			<camel:transacted/>
			<camel:convertBodyTo type="java.lang.String"/>
			<camel:to uri="hubQueue:queue:DEMOEVENT" />
			<camel:to uri="mock:demoevent"/>
		</camel:route>

Route reading from the queue:
                <camel:route id="demoOutRoute">
			<camel:from uri="hubQueue:queue:DEMOEVENT" />
			<camel:transacted/>
			<camel:to uri="file:/data/uddata"/>
			<camel:to uri="mock:demoeventout"/>
		</camel:route>

I get an error when Camel tries to write the file again:
[Camel (demo-out-Context) thread #0 - JmsConsumer[DEMOEVENT]] 03 jun. 2011 -
08:34:33,097 ERROR org.apache.camel.processor.DefaultErrorHandler
[Failed delivery for exchangeId: ID:A4C9E4F7D00B83B2E040650A2B5F4514.
Exhausted after delivery attempt: 1 caught:
org.apache.camel.component.file.GenericFileOperationFailedException: Cannot
store file: \data\uddata\C:\data\indata\ITM545791.XML]
org.apache.camel.component.file.GenericFileOperationFailedException: Cannot
store file: \data\uddata\C:\data\indata\ITM545791.XML

It seems that camel uses the file target dir and concatinates it with the
CamelFileName header from the JmsPayload.

Trace from Jms consumer :
[ID:A4C9E4F7D00B83B2E040650A2B5F4514 >>> (demoOutRoute)
from(hubQueue://queue:DEMOEVENT) --> transacted <<< Pattern:InOnly,
Headers:{JMSRedelivered=false,
JMSMessageID=ID:A4C9E4F7D00B83B2E040650A2B5F4514,
CamelFileAbsolutePath=C:\data\indata\ITM545791.XML, JMSType=null,
JMSXDeliveryCount=1, CamelFileAbsolute=true, CamelFileLength=6988,
JMS_OracleTimestamp=1307082872816, JMSDestination=ESB_APPL.DEMOEVENT,
JMSPriority=1, JMSExpiration=0, JMS_OracleDelay=0, JMSDeliveryMode=2,
JMSXUserID=ESB_APPL, CamelFileName=C:\data\indata\ITM545791.XML,
JMSReplyTo=null, JMSXState=0, CamelFileNameOnly=ITM545791.XML,
CamelFileLastModified=Fri Apr 29 08:32:22 CEST 2011, JMSXGroupID=null,
CamelFilePath=C:\data\indata\ITM545791.XML,
CamelFileRelativePath=ITM545791.XML, JMSTimestamp=1307082872816,
JMSCorrelationID=null, JMSXRecvTimestamp=1307082873082,
CamelFileParent=C:\data\indata, JMS_OracleDeliveryMode=2}, BodyType:String,
Body:<?xml version="1.0" encoding="ISO-8859-1"?>

The workaround is to set the filename header yourself like:
camel:setHeader
headerName="CamelFileName"><camel:simple>${header.CamelFileNameOnly}</camel:simple></camel:setHeader>

But is this nessasary ? Shouldn't the CamelFileName be reusable between the
Jms- and File component so they have the same convention. FileName without
path ?

Preben


 

--
View this message in context: http://camel.465427.n5.nabble.com/CamelFileName-over-JMS-Bug-or-working-as-designed-tp4450339p4450339.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: CamelFileName over JMS - Bug or working as designed ?

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Yes that is working as expected. The filename is relative.


On Fri, Jun 3, 2011 at 8:53 AM, preben <pr...@dr.dk> wrote:
> Hi
>
> I'm sending a file over JMS using Oracle AQ.
>
> InRoute
>               <camel:route id="demoRoute">
>                        <camel:from uri="file:/data/indata"/>
>                        <camel:transacted/>
>                        <camel:convertBodyTo type="java.lang.String"/>
>                        <camel:to uri="hubQueue:queue:DEMOEVENT" />
>                        <camel:to uri="mock:demoevent"/>
>                </camel:route>
>
> Route reading from the queue:
>                <camel:route id="demoOutRoute">
>                        <camel:from uri="hubQueue:queue:DEMOEVENT" />
>                        <camel:transacted/>
>                        <camel:to uri="file:/data/uddata"/>
>                        <camel:to uri="mock:demoeventout"/>
>                </camel:route>
>
> I get an error when Camel tries to write the file again:
> [Camel (demo-out-Context) thread #0 - JmsConsumer[DEMOEVENT]] 03 jun. 2011 -
> 08:34:33,097 ERROR org.apache.camel.processor.DefaultErrorHandler
> [Failed delivery for exchangeId: ID:A4C9E4F7D00B83B2E040650A2B5F4514.
> Exhausted after delivery attempt: 1 caught:
> org.apache.camel.component.file.GenericFileOperationFailedException: Cannot
> store file: \data\uddata\C:\data\indata\ITM545791.XML]
> org.apache.camel.component.file.GenericFileOperationFailedException: Cannot
> store file: \data\uddata\C:\data\indata\ITM545791.XML
>
> It seems that camel uses the file target dir and concatinates it with the
> CamelFileName header from the JmsPayload.
>
> Trace from Jms consumer :
> [ID:A4C9E4F7D00B83B2E040650A2B5F4514 >>> (demoOutRoute)
> from(hubQueue://queue:DEMOEVENT) --> transacted <<< Pattern:InOnly,
> Headers:{JMSRedelivered=false,
> JMSMessageID=ID:A4C9E4F7D00B83B2E040650A2B5F4514,
> CamelFileAbsolutePath=C:\data\indata\ITM545791.XML, JMSType=null,
> JMSXDeliveryCount=1, CamelFileAbsolute=true, CamelFileLength=6988,
> JMS_OracleTimestamp=1307082872816, JMSDestination=ESB_APPL.DEMOEVENT,
> JMSPriority=1, JMSExpiration=0, JMS_OracleDelay=0, JMSDeliveryMode=2,
> JMSXUserID=ESB_APPL, CamelFileName=C:\data\indata\ITM545791.XML,
> JMSReplyTo=null, JMSXState=0, CamelFileNameOnly=ITM545791.XML,
> CamelFileLastModified=Fri Apr 29 08:32:22 CEST 2011, JMSXGroupID=null,
> CamelFilePath=C:\data\indata\ITM545791.XML,
> CamelFileRelativePath=ITM545791.XML, JMSTimestamp=1307082872816,
> JMSCorrelationID=null, JMSXRecvTimestamp=1307082873082,
> CamelFileParent=C:\data\indata, JMS_OracleDeliveryMode=2}, BodyType:String,
> Body:<?xml version="1.0" encoding="ISO-8859-1"?>
>
> The workaround is to set the filename header yourself like:
> camel:setHeader
> headerName="CamelFileName"><camel:simple>${header.CamelFileNameOnly}</camel:simple></camel:setHeader>
>
> But is this nessasary ? Shouldn't the CamelFileName be reusable between the
> Jms- and File component so they have the same convention. FileName without
> path ?
>
> Preben
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/CamelFileName-over-JMS-Bug-or-working-as-designed-tp4450339p4450339.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/