Hello Gert,
Thanks for the response, Please find below the details of what I do in my
component in the following flow-

Files(PDF/TIFF)->File Poller->CustomFileMarshaler (which extends
BinaryFileMarshaler, reads the attachment, stores the contents of polled
files in a temporary location and sends the absolute path of this temporary
location of file in normalizedMessage.setContent)->JMS
Provider->JMSConsumer->Custom Bean where I get the file location from
normalizedMessage.getContent and have the necessary logic.

This flow works fine in native SMX but failed without any modifications in
FuseESB. 

I dont have any debugger on to read StreamSource and I have done the
following to be able to fix the problem-

 1. Different concrete implementations of Source in CustomFileMarshaler: In
our CustomFileMarshaler, we fetch the stream of file, temporarily store the
file and send the path of this temporary location in
normalizedMessage.setContent() method. I tried to send DOMSource,
StringSource and StreamSource as objects.
2. turn on streamCaching() in ServiceRouteBuilder
3. Processor: In ServiceRouteBuilder of DocLoader component, I tried writing
a custom Processor between the file poller endpoint to JMS provider for
DocLoader Queue. Much to our surprise, the code written in the custom
processor was never invoked.
4. I also tried the solution proposed by you which is-
  "avoid
sending the attachments in a non-rereadable format in the first place.
 You could do in your own marshaler by replacing the call to
super.readMessage with a copy of the method contents in the parent
BinaryFileMarshaler, replacing the StreamDataSource used there with
e.g. a BytesDataSource that allows reading from it multiple times."

And got the following error-
org.apache.servicemix.soap.api.Fault: javax.mail.internet.ParseException
        at
org.apache.servicemix.soap.interceptors.mime.AttachmentsOutInterceptor.handleMessage(AttachmentsOutInterceptor.java:69)
        at
org.apache.servicemix.soap.core.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:85)
        at
org.apache.servicemix.jms.endpoints.DefaultProviderMarshaler.createMessage(DefaultProviderMarshaler.java:79)
        at
com.thirdpillar.esb.tuscany.faxUpload.marshaller.CustomJmsProviderMarshaller.createMessage(CustomJmsProviderMarshaller.java:53)
        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:428)
        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:886)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:619)
Caused by: javax.mail.internet.ParseException

Kindly help. I am attaching the Marshaller for your reference.

Thanks,
Richa. http://old.nabble.com/file/p27637602/CustomFileMarshaller.java
CustomFileMarshaller.java 


Gert Vanthienen wrote:
> 
> Richa,
> 
> From the stack trace, it looks like the 'Stream closed' problem occurs
> while trying to send the attachments into a JMS queue.  This usually
> happens when the attachments have been read/processed by something
> before you get to that point.  One way to solve this issue would be to
> find out what is processing the attachments.
> 
> Could you provide us with a bit more details about what you're trying
> to do here (the flow of the message before it reaches the endpoint)?
> Is it possible that the old servicemix instance had DEBUG logging
> enabled and that this has not yet been set on the new instance?  Did
> you create custom exchange listeners or auditors that might have read
> the attachment?
> 
> Another thing you could do to avoid running into this issue, is avoid
> sending the attachments in a non-rereadable format in the first place.
>  You could do in your own marshaler by replacing the call to
> super.readMessage with a copy of the method contents in the parent
> BinaryFileMarshaler, replacing the StreamDataSource used there with
> e.g. a BytesDataSource that allows reading from it multiple times.
> 
> Regards,
> 
> Gert Vanthienen
> ------------------------
> Open Source SOA: http://fusesource.com
> Blog: http://gertvanthienen.blogspot.com/
> 
> 
> 
> On 11 February 2010 06:38, Richa Khurana <[email protected]>
> wrote:
>> Hello everyone,
>> It will be really kind if you provide inputs for the issue, it's a
>> blocker for me and I am not able to go ahead :(
>> Thanks,
>> Richa.
>>
>> -----Original Message-----
>> From: Richa Khurana [mailto:[email protected]]
>> Sent: Wednesday, February 10, 2010 3:56 PM
>> To: [email protected]
>> Subject: Unable to port file poller component to Fuse ESB 3.4
>>
>> Hi,
>>
>>
>>
>> I have a file poller which polls for PDF and TIFF Files. These files
>> once polled are marshaled using CustomFileMarshaler extending from
>> BinaryFileMarshaller which has the following overridden APIs-
>>
>>
>>
>>
>>
>>   �...@override public void readMessage(MessageExchange messageExchange,
>> NormalizedMessage normalizedMessage,
>>
>>        InputStream inputStream, String path) throws IOException,
>> JBIException {
>>
>>
>>
>>        try {
>>
>>            super.readMessage(messageExchange, normalizedMessage,
>> inputStream, path);
>>
>>
>>
>>            String tempFilePathFull =
>> storeUploadedFileInFS(normalizedMessage, path,
>>
>>                    path.substring(path.lastIndexOf(".")));
>>
>>            normalizedMessage.setContent(new StringSource(
>>
>>                    UtilConstants.FILE_POLLER_CUSTOM_TAG_START +
>> tempFilePathFull +
>>
>>                    UtilConstants.FILE_POLLER_CUSTOM_TAG_END));
>>
>>        } catch (IOException exception) {
>>
>>            exception.printStackTrace();
>>
>>            throw exception;
>>
>>        }
>>
>>    }
>>
>>
>>
>> storeUploadedFileInFS(.. creates temp copy of the file being polled)
>>
>> This works completely fine with SMX3.2.x but fails once ported to
>> FuseESB3.4 throwing the below stack trace. Kindly help.
>>
>>
>>
>> WARN  - FileComponent                  - Message in file
>> C:\inbox\Cred_Appr_BCA1.pdf could not be handled successfully:
>> java.io.IOException:
>>
>>  Stream closed
>>
>> org.apache.servicemix.soap.api.Fault: java.io.IOException: Stream closed
>>
>>        at
>> org.apache.servicemix.soap.interceptors.mime.AttachmentsOutInterceptor.h
>> andleMessage(AttachmentsOutInterceptor.java:71)
>>
>>        at
>> org.apache.servicemix.soap.core.PhaseInterceptorChain.doIntercept(PhaseI
>> nterceptorChain.java:85)
>>
>>        at
>> org.apache.servicemix.jms.endpoints.DefaultProviderMarshaler.createMessa
>> ge(DefaultProviderMarshaler.java:79)
>>
>>        at
>> org.apache.servicemix.jms.endpoints.JmsProviderEndpoint.processInOnlyInS
>> ession(JmsProviderEndpoint.java:561)
>>
>>        at
>> org.apache.servicemix.jms.endpoints.JmsProviderEndpoint$1.doInJms(JmsPro
>> viderEndpoint.java:531)
>>
>>        at
>> org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:428)
>>
>>        at
>> org.apache.servicemix.jms.endpoints.JmsProviderEndpoint.processInOnly(Jm
>> sProviderEndpoint.java:542)
>>
>>        at
>> org.apache.servicemix.jms.endpoints.JmsProviderEndpoint.process(JmsProvi
>> derEndpoint.java:499)
>>
>>        at
>> org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeC
>> ycle.java:627)
>>
>>        at
>> org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBas
>> eLifeCycle.java:581)
>>
>>        at
>> org.apache.servicemix.common.AsyncBaseLifeCycle.onMessageExchange(AsyncB
>> aseLifeCycle.java:535)
>>
>>        at
>> org.apache.servicemix.common.SyncLifeCycleWrapper.onMessageExchange(Sync
>> LifeCycleWrapper.java:60)
>>
>>        at
>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(D
>> eliveryChannelImpl.java:623)
>>
>>        at
>> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.j
>> ava: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:1
>> 34)
>>
>>        at
>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecuto
>> r.java:886)
>>
>>        at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.ja
>> va:908)
>>
>>        at java.lang.Thread.run(Thread.java:619)
>>
>> Caused by: java.io.IOException: Stream closed
>>
>>        at
>> java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:145)
>>
>>        at
>> java.io.BufferedInputStream.read(BufferedInputStream.java:308)
>>
>>        at java.io.FilterInputStream.read(FilterInputStream.java:90)
>>
>>        at javax.activation.DataHandler.writeTo(DataHandler.java:293)
>>
>>        at
>> javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1350)
>>
>>        at
>> javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:845)
>>
>>        at
>> javax.mail.internet.MimeMultipart.writeTo(MimeMultipart.java:361)
>>
>>        at
>> com.sun.mail.handlers.multipart_mixed.writeTo(multipart_mixed.java:85)
>>
>>        at
>> javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:869)
>>
>>        at javax.activation.DataHandler.writeTo(DataHandler.java:302)
>>
>>        at
>> javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1350)
>>
>>        at
>> javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1683)
>>
>>        at
>> org.apache.servicemix.soap.interceptors.mime.AttachmentsOutInterceptor.w
>> riteMultipartMessage(AttachmentsOutInterceptor.java:130)
>>
>>        at
>> org.apache.servicemix.soap.interceptors.mime.AttachmentsOutInterceptor.h
>> andleMessage(AttachmentsOutInterceptor.java:67)
>>
>>
>>
>> Richa Khurana| Associate Consultant - Engineering| GlobalLogic Inc.
>> USA | INDIA | UKRAINE | CHINA
>> Office: +91.120.406.2681
>>
>> www.globallogic.com <http://www.globallogic.com/>
>> InfoWorld Award Winner for Agile Innovation
>> <http://www.globallogic.com/Media/pressReleaseDetail.asp?press/65>
>>
>> Disclaimer: http://www.globallogic.com/email_disclaimer.txt
>> <http://www.globallogic.com/email_disclaimer.txt>
>>
>>
>>
>>
> 
> 
> -----
> ---
> Gert Vanthienen
> http://gertvanthienen.blogspot.com
> 

-- 
View this message in context: 
http://old.nabble.com/Unable-to-port-file-poller-component-to-Fuse-ESB-3.4-tp27529046p27637602.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Reply via email to