You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by marnold <ma...@gmail.com> on 2012/07/27 18:08:48 UTC
After split, get Stream closed on original message
Camel Users,
I need to take a large XML message, split into smaller messages, send each
small message to a JMS destination, then apply XSLT to original message and
send that somewhere else...
The split works well, the smaller messages are processed correctly, but when
I try to apply an XSLT to the original (pre-split) message, I get stream
closed.
My route:
<route id="abc">
<from uri="......."/>
<split streaming="false" stopOnException="true" shareUnitOfWork="true">
<tokenize token="insideTag" inheritNamespaceTagName="outsideTag"
xml="true"/>
<to uri="jms:queue.myJmsQueue"/>
</split>
<to uri="xslt:myTransform.xsl"/>
<to uri="..."/>
</route>
I get this exception:
[ampPoll] TimerConsumer ERROR Error processing exchange.
Exchange[Message: [Body is instance of java.io.InputStream]]. Caused by:
[javax.xml.transform.TransformerException -
javax.xml.transform.TransformerException:
com.sun.org.apache.xml.internal.utils.WrappedRuntimeException: Stream
closed]
javax.xml.transform.TransformerException:
javax.xml.transform.TransformerException:
com.sun.org.apache.xml.internal.utils.WrappedRuntimeException: Stream closed
If I replace the <to uri="xslt..."/> with <to uri="file:output.log"/>, I get
this exception:
[ampPoll] TimerConsumer ERROR Error processing exchange.
Exchange[Message: [Body is instance of java.io.InputStream]]. Caused by:
[org.apache.camel.component.file.GenericFileOperationFailedException -
Cannot store file: output.log\my-hostname-57144-1343404520362-0-3]
org.apache.camel.component.file.GenericFileOperationFailedException: Cannot
store file: output.log\my-hostname-57144-1343404520362-0-3
Thanks in advance for any help,
--
View this message in context: http://camel.465427.n5.nabble.com/After-split-get-Stream-closed-on-original-message-tp5716557.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: After split, get Stream closed on original message
Posted by marnold <ma...@gmail.com>.
Sorry - should've mentioned. As is apparent from the exception, I am using
<timer> at the top of my route, followed by <to uri="http://...."> . Not
sure if that makes a difference...
--
View this message in context: http://camel.465427.n5.nabble.com/After-split-get-Stream-closed-on-original-message-tp5716557p5716559.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: After split, get Stream closed on original message
Posted by Christian Müller <ch...@gmail.com>.
No problem. Good to know it fixed your issue.
Best,
Christian
On Mon, Jul 30, 2012 at 6:11 PM, marnold <ma...@gmail.com> wrote:
> Thanks Christian, that's works nicely.
>
> I knew it must've been something like that, just didn't know the Camel-way
> to fix it.
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/After-split-get-Stream-closed-on-original-message-tp5716557p5716606.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
Re: After split, get Stream closed on original message
Posted by marnold <ma...@gmail.com>.
Thanks Christian, that's works nicely.
I knew it must've been something like that, just didn't know the Camel-way
to fix it.
--
View this message in context: http://camel.465427.n5.nabble.com/After-split-get-Stream-closed-on-original-message-tp5716557p5716606.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: After split, get Stream closed on original message
Posted by Christian Müller <ch...@gmail.com>.
You have to cache the stream if you want to read it multiple times:
http://camel.apache.org/stream-caching.html
Best,
Christian
On Fri, Jul 27, 2012 at 6:08 PM, marnold <ma...@gmail.com> wrote:
> Camel Users,
>
> I need to take a large XML message, split into smaller messages, send each
> small message to a JMS destination, then apply XSLT to original message and
> send that somewhere else...
>
> The split works well, the smaller messages are processed correctly, but
> when
> I try to apply an XSLT to the original (pre-split) message, I get stream
> closed.
>
> My route:
>
> <route id="abc">
> <from uri="......."/>
> <split streaming="false" stopOnException="true"
> shareUnitOfWork="true">
> <tokenize token="insideTag"
> inheritNamespaceTagName="outsideTag"
> xml="true"/>
> <to uri="jms:queue.myJmsQueue"/>
> </split>
> <to uri="xslt:myTransform.xsl"/>
> <to uri="..."/>
> </route>
>
> I get this exception:
>
> [ampPoll] TimerConsumer ERROR Error processing exchange.
> Exchange[Message: [Body is instance of java.io.InputStream]]. Caused by:
> [javax.xml.transform.TransformerException -
> javax.xml.transform.TransformerException:
> com.sun.org.apache.xml.internal.utils.WrappedRuntimeException: Stream
> closed]
> javax.xml.transform.TransformerException:
> javax.xml.transform.TransformerException:
> com.sun.org.apache.xml.internal.utils.WrappedRuntimeException: Stream
> closed
>
> If I replace the <to uri="xslt..."/> with <to uri="file:output.log"/>, I
> get
> this exception:
>
> [ampPoll] TimerConsumer ERROR Error processing exchange.
> Exchange[Message: [Body is instance of java.io.InputStream]]. Caused by:
> [org.apache.camel.component.file.GenericFileOperationFailedException -
> Cannot store file: output.log\my-hostname-57144-1343404520362-0-3]
> org.apache.camel.component.file.GenericFileOperationFailedException: Cannot
> store file: output.log\my-hostname-57144-1343404520362-0-3
>
> Thanks in advance for any help,
>
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/After-split-get-Stream-closed-on-original-message-tp5716557.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>