Read Dan, not me. I was not turned into the optimization he describes -- and now I'm feeling really incented to refactor a service so that it can't possibly need two attachments in any single message.
2010/10/8 Jimi Hullegård <[email protected]>: > This sounds very strange to me, since I was under the assumption that using > an MTOM-enabled CXF service and a DataHandler, one could stream the data > without having to store it in its entirety on either side. Ie, in theory one > could transfer a 100GB file between two machines that both has little RAM and > were the client machine has a very limited disk space (ie smaller then > 100GB), as long as the client handles the data as it reads it from the > stream, without writing it to disk. Are you saying that this is impossible? > So the answer in this thread: > > http://stackoverflow.com/questions/3850399/transfer-large-messaeges-with-apache-cxf > > ...is wrong? > > And what you are saying is that even if I never read the InputStream, if the > InputStream is mapped to a 100GB blob in the database, the entire 100GB data > will be transfered? This is really bad news for me, but good that I asked so > I can fix it. The solution I'm leaning against now is to split this entity > into two different entities, one with the metadata, and one with the Blob, so > one has to specifically request the binary data in order to get it. > > /Jimi > > ________________________________________ > Från: Benson Margulies [[email protected]] > Skickat: den 8 oktober 2010 15:16 > Till: [email protected] > Ämne: Re: When transfering an object with a DataHandler field, is it OK not > to read from the InputStream? > > On the wire, that blob has to travel as a MIME part. And there might > be several such MIME parts. Unless you traffic in interceptors, as far > as I know, the entire content will be pulled into memory, unless it's > very big, in which case it ends up in a temp file. CXF can't just > leave the socket that the data is arriving on sitting there waiting > for you to read the stream on the data handler. > > > 2010/10/8 Jimi Hullegård <[email protected]>: >> Hi, >> >> I have set up a simple webservice for testing, where the object to transfer >> contains a bunch of simple fields, and then a DataHandler for some binary >> data (a Blob, actually). It works just fine, and some test with large files >> (500MB) proved to me that it really works without having the entire data in >> memory on the server or on the client. >> >> But then I realised that in most use cases, we will not need this binary >> data, so on the client side we will not read from the InputStream of the >> DataHandler. But can that cause any problem? Because when I think about it I >> don't really know how CXF handles this DataHandler. Maybe it assumes that >> the entire content of the DataHandler InputStream will be sent, and that it >> keeps the connection open until the client has finished reading, or until >> some timeout. Or maybe it assumes the opposite, that it can close the >> connection after it has transfered the "normal" data, and then open a new >> connection if the client starts to read from the InputStream of the >> DataHandler. >> >> If it is something like the first scenario, that what can I do to transfer >> this object the right way, without having to read the InputStream? I can't >> find any information about this in the documentation. >> >> Regards >> /Jimi
