As you said ByteArrayDataSource causes out of memory issues. but if we use the StreamDatasource we can read the content only once through out the process.
lhe77 wrote: > > Given a binary file to use as attachment as an example: > > The binary file marshaler would open a stream to this file and add this > stream > packed as DataHandler object to the message (as attachment). > The file is not moved in any way, just this reference to the input stream > is > moved. If you read this stream twice, you run into a StreamClosedException > or > something similar because a stream can't be read twice like this. > Also when sending a DONE back to the file poller will maybe delete the > file and > when you try to access it afterwards you will run into an exception as > well. > So don't DONE it too early. > > The ByteArrayDataSource has a backup byte buffer where the data will be > stored. > On each request to the stream of this data source a new stream will be > generated an so you will be able to read the stream x times without > errors. > The big backdraw of this data source is the memory consumption as the byte > array will occupy depending on the size of your data a lot of memory and > may > cause a java.lang.OutOfMemoryError in some cases. > > Maybe this helps you seeing things more clear. > > Regards > Lars > > > > Am Dienstag 26 August 2008 06:01:37 schrieb Johnson George: >> Thanks Sachin. >> >> ByteArrayDataSource works great and I see my attachement contents. But >> what >> difference it makes using ByteArrayDataSource over StreamDataSource espl >> while adding attachement? > > > ----- Cheers Praveen Oruganti "Think before you act and act on what you believe" -- View this message in context: http://www.nabble.com/Attachement-missing-in-response-tp18955225p19328186.html Sent from the ServiceMix - User mailing list archive at Nabble.com.
