camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: zip file best practices
Date Thu, 07 Jun 2012 07:34:38 GMT
On Mon, May 28, 2012 at 5:55 PM, Christian Müller
<christian.mueller@gmail.com> wrote:
> What do you think about the following proposal:
>
> 1) Add a type converter which supports a conversion from InputStream ->
> ZipFile and from InputStream -> ZipInputStream
> 2) Implement a splitter which extract the (multiple) ZipEntry, add some
> header to each of them (name of the entry, number of entries, size, ...)
> and put them into its own exchange.
>

Yeah that sounds reasonable. A prototype is usually a good idea to try
it out and see what works.


> For the other way (create a zip archive which contain multiple entries),
> you could provide an Aggregator (AggregationStrategy) which work with
> ZipEntries...
>

I wonder if its not easier to allow to append to an existing file,
which is a .zip file as well?


> My 0.02$,
> Christian
>
> On Fri, May 25, 2012 at 1:29 PM, Tyler Durvik <phangbyte@gmail.com> wrote:
>
>> I am working on a solution for this that I can contribute to Camel.  I
>> have the files being unzipped in a processor.  The processor then sets
>> a header value which is a comma-separated string listing the files.
>> The problem I see is that I want the splitter to generate a new Camel
>> Message object for each file in zip file.  Then in each Message object
>> I set a filename header for each the file that message represents.
>> The problem is that the splitter generates 2 messages, each with the
>> same file header value.  So here is my flow:
>>
>> Zip File
>>
>> |
>>
>> Unzip Processor - uncompress zip which is contained in body, then set
>> header.  key = filenames, values=file1,file2
>>
>> |
>>
>> Splitter - based on "filenames" header,  set new key = filename
>>
>> |
>>
>> Message 1 - key = filename, value = file1
>> Message 2 - key = filename, value = file1
>>
>>
>> What I want is the header of Message 2 to contain file2.  I will write
>> unit test to verify this if anyone does not understand or know how to
>> help.
>>
>> Thank you for your help,
>> Tyler
>>
>>
>>
>> On Thu, May 24, 2012 at 1:18 AM, Claus Ibsen <claus.ibsen@gmail.com>
>> wrote:
>> > On Wed, May 23, 2012 at 10:43 PM, Tyler Durvik <phangbyte@gmail.com>
>> wrote:
>> >> I am receiving data message from client and the body of the message is
>> >> a zip file containing multiple files.  What is the best method to
>> >> process the zip data?  I assume that I should use a StreamMessage.  Is
>> >> there support for Camel to unzip the body as I receive it like
>> >> marshaling or do I need to write an unzip processor or splitter.
>> >>
>> >> Thank you for your time,
>> >> Tyler
>> >
>> > You would need to write code to unzip that yourself.
>> >
>> > The zip/gzip data formats is for compressing/decompression message
>> > bodies, not zip files.
>> >
>> > There is a JIRA ticket to see if we can add support for zip files as
>> well.
>> > Contributions is as always welcome.
>> >
>> > For example maybe a iterator that can walk the zip file entries, which
>> > you can then use with the Splitter EIP to process each file by file.
>> >
>> >
>> >
>> > --
>> > Claus Ibsen
>> > -----------------
>> > CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
>> > FuseSource
>> > Email: cibsen@fusesource.com
>> > Web: http://fusesource.com
>> > Twitter: davsclaus, fusenews
>> > Blog: http://davsclaus.blogspot.com/
>> > Author of Camel in Action: http://www.manning.com/ibsen/
>>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Mime
View raw message