Stefan,

We commonly use a streaming Source type in ServiceMix for performance
reasons.  It allows us to e.g. send huge XML files through the NMR
without having to load the entire message into memory or without
having to build build a DOM tree for it or whatever.  As long as
you're working with the standard components, these should be aware of
the use of Stream/StaxSource but, as an unfortunate side-effect, they
require you to take extra care if you're writing your own code to
integrate with ServiceMix.

Regards,

Gert Vanthienen
------------------------
Open Source SOA: http://fusesource.com
Blog: http://gertvanthienen.blogspot.com/



2009/5/12 Stefan Weber <[email protected]>:
>
> Once again thx Gert ;)
>
> Just got rid of that creepy error. It was exactly the point you mentioned.
> But it's an enigma for me, why the StAXSource is used at all.
>
> By Stefan
>
>
>
> Stefan Weber wrote:
>>
>> Thx for the Reply,
>>
>> i think you hint will solve the problem.
>> After i poll the exchange from the JMS i "read" the content. Then i
>> transfer the in message to out message. Then, as you said, it wont be
>> readable on the provider side again. I will check this tomorrow and keep
>> this thread up to date.
>>
>> Hope this works :)
>>
>> Thx Stefan
>>
>>
>> Gert Vanthienen wrote:
>>>
>>> Stefan,
>>>
>>> You mention processing the Exchange.  How do you do that -- i.e. which
>>> component are you using?  If you're doing any coding yourself, you
>>> should be aware that a StaxSource can only be read once, so if you're
>>> using it multiple time (e.g. reading the message AND setting it back
>>> on the 'out' NormalizedMessage), you should first convert it to
>>> re-readable Source type.
>>>
>>> Unfortunately, the convenient MessageUtil.enableContentRereadability()
>>> method is broken for StaxSources in ServiceMix 3.3 [1], so you would
>>> have to do that yourself (e.g. transform to a String and then use a
>>> StringSource on the 'out' message).
>>>
>>>
>>> Regards,
>>>
>>> Gert Vanthienen
>>> ------------------------
>>> Open Source SOA: http://fusesource.com
>>> Blog: http://gertvanthienen.blogspot.com/
>>>
>>>
>>> [1] https://issues.apache.org/activemq/browse/SM-1830
>>>
>>>
>>> 2009/5/11 Stefan Weber <[email protected]>:
>>>>
>>>> Hi,
>>>>
>>>> i'm using  a synchonous jms-queue (provider + consumer with
>>>> replydestinations).
>>>> The "in" messages of the InOut exchanges have a DOMSource as content.
>>>> After
>>>> submiting and polling trought the consumer the exchanges message content
>>>> changed from DOMsource to StAXSource. Fine so far. I process the
>>>> exchange
>>>> and send the exchange with the "in" message transfered to "out" back to
>>>> the
>>>> jms queue.
>>>>
>>>> Then the following exception is raised:
>>>>
>>>> 15:30:47,718 | DEBUG | tenerContainer-1 | PhaseInterceptorChain
>>>>    |
>>>> .soap.core.PhaseInterceptorChain   83 | Invoking handleMessage on
>>>> interceptor
>>>> org.apache.servicemix.soap.interceptors.mime.AttachmentsInInterceptor
>>>> 15:30:47,718 | DEBUG | tenerContainer-1 | PhaseInterceptorChain
>>>>    |
>>>> .soap.core.PhaseInterceptorChain   83 | Invoking handleMessage on
>>>> interceptor
>>>> org.apache.servicemix.soap.interceptors.xml.StaxInInterceptor
>>>> 15:30:47,718 | INFO  | tenerContainer-1 | PhaseInterceptorChain
>>>>    |
>>>> .soap.core.PhaseInterceptorChain   89 | Interceptor has thrown
>>>> exception,
>>>> unwinding now
>>>> 15:30:47,718 | DEBUG | tenerContainer-1 | PhaseInterceptorChain
>>>>    |
>>>> .soap.core.PhaseInterceptorChain   96 | Invoking handleFault on
>>>> interceptor
>>>> org.apache.servicemix.soap.interceptors.xml.StaxInInterceptor
>>>> 15:30:47,718 | DEBUG | tenerContainer-1 | PhaseInterceptorChain
>>>>    |
>>>> .soap.core.PhaseInterceptorChain   96 | Invoking handleFault on
>>>> interceptor
>>>> org.apache.servicemix.soap.interceptors.mime.AttachmentsInInterceptor
>>>> 15:30:47,718 | DEBUG | tenerContainer-1 | JmsComponent
>>>>   |
>>>> ms.endpoints.JmsProviderEndpoint  758 | Error while populating JBI
>>>> exchange
>>>> org.apache.servicemix.jbi.runtime.impl.inouti...@1eafe13
>>>> 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.StaxInInterceptor.handleMessage(StaxInInterceptor.java:64)
>>>>        at
>>>> org.apache.servicemix.soap.core.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:85)
>>>>        at
>>>> org.apache.servicemix.jms.endpoints.DefaultProviderMarshaler.populateMessage(DefaultProviderMarshaler.java:108)
>>>>        at
>>>> org.apache.servicemix.jms.endpoints.JmsProviderEndpoint.onMessage(JmsProviderEndpoint.java:754)
>>>>        at
>>>> org.apache.servicemix.jms.endpoints.JmsProviderEndpoint$5.onMessage(JmsProviderEndpoint.java:948)
>>>>        at
>>>> org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:543)
>>>>        at
>>>> org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:482)
>>>>        at
>>>> org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:451)
>>>>        at
>>>> org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:323)
>>>>        at
>>>> org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:261)
>>>>        at
>>>> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:982)
>>>>        at
>>>> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:974)
>>>>        at
>>>> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:876)
>>>>        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
>>>> javax.xml.stream.util.StreamReaderDelegate.next(StreamReaderDelegate.java:51)
>>>>        at
>>>> org.apache.servicemix.soap.util.stax.ExtendedXMLStreamReader.next(ExtendedXMLStreamReader.java:61)
>>>>        at
>>>> org.apache.servicemix.soap.util.stax.ExtendedXMLStreamReader.nextTag(ExtendedXMLStreamReader.java:44)
>>>>        at
>>>> org.apache.servicemix.soap.interceptors.xml.StaxInInterceptor.handleMessage(StaxInInterceptor.java:61)
>>>>        ... 13 more
>>>>
>>>>
>>>> The following jms queue definitions are used:
>>>>
>>>>    &lt;!-- JMS InQueue endpoint --&gt;
>>>>    &lt;jms:provider service=&quot;cp:inQueueingSync&quot;
>>>>        endpoint=&quot;endpoint&quot;
>>>>        destinationName=&quot;sync.in&quot;
>>>>        replyDestinationName=sync.out&quot;
>>>>        connectionFactory=&quot;#connectionFactory&quot; /&gt;
>>>>
>>>>    &lt;!-- JMS InQueue poller endpoint --&gt;
>>>>    &lt;jms:consumer service=&quot;cp:inQueueSyncPoller&quot;
>>>>        endpoint=&quot;endpoint&quot;
>>>>        destinationName=&quot;sync.in&quot;
>>>>        replyDestinationName=&quot;sync.out&quot;
>>>>        targetService=&quot;cp:myTargetService&quot;
>>>>        concurrentConsumers=&quot;2&quot;
>>>>        cacheLevel=&quot;3&quot;
>>>>        connectionFactory=&quot;#connectionFactory&quot;&gt;
>>>>
>>>>        &lt;property name=&quot;marshaler&quot;&gt;
>>>>            &lt;bean
>>>> class=&quot;org.apache.servicemix.jms.endpoints.DefaultConsumerMarshaler&quot;&gt;
>>>>                &lt;property name=&quot;mep&quot;
>>>> value=&quot;http://www.w3.org/2004/08/wsdl/in-out&quot; /&gt;
>>>>            &lt;/bean&gt;
>>>>        &lt;/property&gt;
>>>>
>>>>    &lt;/jms:consumer&gt;
>>>>
>>>>
>>>> Debug-msg from exchange send TO the queue
>>>>
>>>>  id:        86be494a-e280-4fcf-82a7-57432224bcff
>>>>  mep:       InOut
>>>>  status:    Active
>>>>  role:      Consumer
>>>>  target:
>>>>  PropertyMatchingReference[{SERVICE_NAME={xxx}inQueueingSync}]
>>>>  properties: [
>>>>      javax.jbi.messaging.MessageExchange =
>>>> org.apache.servicemix.jbi.runtime.impl.inouti...@1eafe13
>>>>      javax.jbi.messaging.sendSync = true
>>>>      javax.jbi.ServiceName = {xxx}inQueueingSync
>>>>      org.apache.servicemix.correlationId =
>>>> 634f215d-fa88-45d1-ab44-9b5da00d7da9
>>>>      javax.jbi.transaction.jta =
>>>>      javax.jbi.InterfaceName =
>>>>      org.apache.servicemix.senderEndpoint = {xxx}router:endpoint
>>>>  ]
>>>>  In: [
>>>>    content: <?xml version="1.0" encoding="UTF-8"
>>>> standalone="no"?>codehere
>>>>    properties: [
>>>>      javax.jbi.messaging.sendSync = true
>>>>      cp-jdocument-id = 1234567890
>>>>      cp-target-ext = xxx
>>>>    ]
>>>>  ]
>>>> ]
>>>>
>>>> Debug-msg from the exchange send BACK to the queue as reply
>>>>
>>>> [
>>>>  id:        36ef4069-bc30-42de-9e1d-4ae694171b79
>>>>  mep:       InOut
>>>>  status:    Done
>>>>  role:      Consumer
>>>>  target:
>>>>  PropertyMatchingReference[{SERVICE_NAME={xxx}myTargetService}]
>>>>  properties: [
>>>>      javax.jbi.ServiceEndpoint =
>>>> org.apache.servicemix.jbi.runtime.impl.serviceendpointi...@1fdbab5
>>>>      javax.jbi.messaging.MessageExchange =
>>>> org.apache.servicemix.jbi.runtime.impl.inouti...@158517d
>>>>      javax.jbi.messaging.sendSync =
>>>>      javax.jbi.servicedesc.ServiceEndpoint =
>>>> org.apache.servicemix.jbi.runtime.impl.endpointi...@3d899a
>>>>      javax.jbi.ServiceName = {xxx}myTargetService
>>>>      org.apache.servicemix.correlationId =
>>>> 36ef4069-bc30-42de-9e1d-4ae694171b79
>>>>      javax.jbi.transaction.jta =
>>>>      javax.jbi.InterfaceName =
>>>>      org.apache.servicemix.senderEndpoint =
>>>> {xxx}inQueueSyncPoller:endpoint
>>>>  ]
>>>>  In: [
>>>>    content: org.apache.servicemix.soap.util.stax.staxsou...@14e1672
>>>>    properties: [
>>>>      javax.jbi.messaging.sendSync = true
>>>>      cp-jdocument-id = 1234567890
>>>>      cp-target-ext = xxx
>>>>      org.apache.servicemix.file.path =
>>>> C:\DOKUME~1\swe\LOKALE~1\Temp\1242048647062_synchon_tester.pdf
>>>>    ]
>>>>  ]
>>>>  Out: [
>>>>    content: org.apache.servicemix.soap.util.stax.staxsou...@14e1672
>>>>    properties: [
>>>>      javax.jbi.messaging.sendSync = true
>>>>      cp-jdocument-id = 1234567890
>>>>      cp-target-ext = xxx
>>>>      org.apache.servicemix.file.path =
>>>> C:\DOKUME~1\swe\LOKALE~1\Temp\1242048647062_synchon_tester.pdf
>>>>    ]
>>>>  ]
>>>> ]
>>>>
>>>>
>>>> Any help would be nice!
>>>>
>>>> Thx Stefan
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/Unexpected-EOF-in-prolog-while-using-synchonous-JMS-queues-tp23484075p23484075.html
>>>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>>>
>>>
>>>
>>> -----
>>> ---
>>> Gert Vanthienen
>>> http://gertvanthienen.blogspot.com
>>>
>>
>>
>
> --
> View this message in context: 
> http://www.nabble.com/Unexpected-EOF-in-prolog-while-using-synchonous-JMS-queues-tp23484075p23496842.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>

Reply via email to