L.S., The BinaryFileMarshaler is a way to allow ServiceMix to handle non-XML payloads. Since the NMR itself only support XML message bodies, we use an attachment to store the binary content. If you configure the BinaryFileMarshaler on a file sender endpoint, it expects that the MessageExchange contains an attachment with the name mentioned in the exception. This means you'll configure the BinaryFileMarshaler on the file poller as well or either add the attachment to the MessageExchange yourself.
For your use case, one option would be to not use the ServiceMix file poller endpoint but rather use a Camel file endpoint instead. A Camel Exchange is capable of carrying arbitrary payloads. This way, you could handle every related to dealing with non-XML-payloads inside Camel. Once you ensured that the XML message is formatted correctly, you could then send the MessageExchange into the JBI NMR to do all your other processing. Regards, Gert Vanthienen ------------------------ Open Source SOA: http://fusesource.com Blog: http://gertvanthienen.blogspot.com/ 2009/3/23 jcamus <[email protected]>: > > Hi ! > I am having this error when I send a bad xml file (not a correct xml file > format) to the following architecture : > > filePoller(in) -> CamelRouting -> fileSender (ok) > (deadLetterManager -> fileSender (ko) > > The fileSender (ko) has a > org.apache.servicemix.components.util.BinaryFileMarshaler while > the filePoller (in) a the standard fileMarshaller. > > The stacktrace is the following : > > javax.jbi.messaging.MessagingException: Could not find attachment: > org.apache.servicemix.file.content > at > org.apache.servicemix.components.util.BinaryFileMarshaler.writeMessage(BinaryFileMarshaler.java:93) > at > org.apache.servicemix.file.FileSenderEndpoint.processInOnly(FileSenderEndpoint.java:86) > at > org.apache.servicemix.common.endpoints.ProviderEndpoint.process(ProviderEndpoint.java:102) > at > org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:600) > at > org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:554) > at > org.apache.servicemix.common.AsyncBaseLifeCycle.onMessageExchange(AsyncBaseLifeCycle.java:510) > at > org.apache.servicemix.common.SyncLifeCycleWrapper.onMessageExchange(SyncLifeCycleWrapper.java:60) > at > org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:620) > 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:885) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907) > at java.lang.Thread.run(Thread.java:619) > > Why the fileSender(ko) which is binaryFileMarshaller need an attachment ? > > Regards. > > > -- > View this message in context: > http://www.nabble.com/MessagingException%3A-Could-not-find-attachment%3A-org.apache.servicemix.file.content-tp22659556p22659556.html > Sent from the ServiceMix - User mailing list archive at Nabble.com. > >
