Using Stream bodies
If you are using a stream type as the message body, you should be aware
that a stream is only capable of being read once. So if you enable DEBUG
logging, the body is usually logged and thus read. To deal with this,
Camel has a streamCaching option that can cache the stream, enabling you
to read it multiple times.
from("jbi:endpoint:http://foo.bar.org/MyService/MyEndpoint").streamCaching().to("xslt:transform.xsl",
"bean:doSomething");
From *Camel 1.5* onwards, the stream caching is default enabled, so it
is not necessary to set the streamCaching() option.
In *Camel 2.0* we store big input streams (by default, over 64K) in a
temp file using CachedOutputStream. When you close the input stream, the
temp file will be deleted.
Raphaël Delaporte a écrit :
I've this errors
INFO - PhaseInterceptorChain - Interceptor has thrown exception,
unwinding now
org.apache.servicemix.soap.api.Fault: com.ctc.wstx.exc.WstxEOFException:
Unexpected EOF in prolog
at [row,col {unknown-source}]: [1,0]
at
org.apache.servicemix.soap.interceptors.xml.BodyOutInterceptor.handleMessage(BodyOutInterceptor.java:41)
at
org.apache.servicemix.soap.core.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:85)
at
org.apache.servicemix.soap.interceptors.xml.StaxOutInterceptor.handleMessage(StaxOutInterceptor.java:50)
at
org.apache.servicemix.soap.core.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:85)
at
org.apache.servicemix.jms.endpoints.DefaultProviderMarshaler.createMessage(DefaultProviderMarshaler.java:79)
at
org.apache.servicemix.jms.endpoints.JmsProviderEndpoint.processInOnlyInSession(JmsProviderEndpoint.java:561)
at
org.apache.servicemix.jms.endpoints.JmsProviderEndpoint$1.doInJms(JmsProviderEndpoint.java:531)
at
org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:471)
at
org.apache.servicemix.jms.endpoints.JmsProviderEndpoint.processInOnly(JmsProviderEndpoint.java:542)
at
org.apache.servicemix.jms.endpoints.JmsProviderEndpoint.process(JmsProviderEndpoint.java:499)
at
org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:627)
at
org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:581)
at
org.apache.servicemix.common.AsyncBaseLifeCycle.onMessageExchange(AsyncBaseLifeCycle.java:535)
at
org.apache.servicemix.common.SyncLifeCycleWrapper.onMessageExchange(SyncLifeCycleWrapper.java:60)
at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:623)
at
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:172)
at
org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:168)
at
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
at java.lang.Thread.run(Thread.java:595)
Caused by: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog
at [row,col {unknown-source}]: [1,0]
at
com.ctc.wstx.sr.StreamScanner.throwUnexpectedEOF(StreamScanner.java:686)
at
com.ctc.wstx.sr.BasicStreamReader.handleEOF(BasicStreamReader.java:2134)
at
com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2040)
at
com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069)
at
org.apache.servicemix.soap.util.stax.StaxUtil.copy(StaxUtil.java:195)
at
org.apache.servicemix.soap.interceptors.xml.BodyOutInterceptor.handleMessage(BodyOutInterceptor.java:39)
... 20 more
Raphaël
Le 19 janvier 2010 00:00, Raphaël Delaporte <[email protected]> a
écrit :
Hi,
I've still have issue with the JMS and Camel component.
I'm running on SMX 3.3.1, and the 2009.02 version for both JMS and Camel.
I've this kind of route which is working (and useless by the way)
<jms:consumer service="esb:jmsConsumer" endpoint="jmsConsumer"
targetService="esb:camelJBI" targetEndpoint="camelJBI"
destinationName="queue/in" connectionFactory="#connectionFactory"
/>
from("jbi:endpoint:http://esb/camelJBI/camelJBI")
.to("jbi:endpoint:http://esb/jmsProvider/jmsProvider");
<jms:provider service="esb:jmsProvider" endpoint="jmsProvider"
destinationName="queue/out" connectionFactory="#connectionFactory"
/>
If I just change my camel route to this (just adding the camel log
endpoint)
from("jbi:endpoint:http://esb/camelJBI/camelJBI")
.to("log:myClass.class")
.to("jbi:endpoint:http://esb/jmsProvider/jmsProvider");
It does not work anymore ... Is it a bug, or is it a MEP related ?
Thanks.
Raphaël