We have several DataFormat implementations that handle a variety of
compression algorithms.  We use these as beans in routes to
marshal/unmarshal.  Here is an example unmarshal:

where zip is our Zip DataFormat implementation bean.

<when id="obsRouter-Zip">
    <simple>${file:name} regex 'obs-.*\.zip'</simple>
    <unmarshal ref="zip"/>
    <split>
        <simple>${header.CamelGroupedExchange}</simple>
        <!-- to dynamic router -->
        <bean ref="routeManager" method="route(*)"/>
    </split>
</when>


And here is a marshall example:

<aggregate strategyRef="codacAggregator" completionSize="1000"
completionInterval="5000">
    <correlationExpression>
        <constant>true</constant>
    </correlationExpression>
    <marshal ref="zip"/>
    <setHeader headerName="CamelFileName">
        <simple>${file:name}.zip</simple>
    </setHeader>
    <to uri="bean:ingestClient"/>
</aggregate>


My question is where is it documented how Camel will call the marshal and
unmarshal methods?  For example in the following marshal method what will
Camel set in the Exchange and Object parameters?

void marshal(Exchange exchange, Object graph, OutputStream stream)
throws Exception

E.g. there has to be some convention of where Camel put all the files that
are being combined into a single zip file.  Are the files in the Exchange's
Exchange.GROUPED_EXCHANGE property?  Or are they somehow retrieved via the
Exchange's getIn()?  I'm looking at some of our existing code and its
getting from both which seems wrong.  I'm trying to write some unit tests
for our code and I need to put the files in the same place that Camel will
put them at runtime but don't see any docs on how Camel handles this.

Then regarding unmarshal its a similar questions where does Camel want me
to put the un-zipped files?  As a Exchange.GROUPED_EXCHANGE Exchange
property that has a list of Messages (where each is a file)?  Same if just
one file?  What about the unmarshal Object return value, any need to set
that?  If so to what?

Could someone point me in the right direction?

-Dave

Reply via email to