Hi Zemian,

Thanks for putting me on the right track with the idempotentConsumer!

Since Flatpack puts the records in a Java Map in the Body I had to do a
convertTo and ended up with the following:

<bean id="organisationMemoryRepository"
class="org.apache.camel.processor.idempotent.MemoryIdempotentRepository" />
...
<route id="process-line">
<from uri="flatpack:fixed:kbo.pzmap.xml" />
<convertBodyTo type="java.util.Map"/>
<filter>
<ognl>request.body["ACTION"] == "070"</ognl>
<idempotentConsumer messageIdRepositoryRef="organisationMemoryRepository">
<ognl>request.body["ORGANISATION"]</ognl>
<to uri="log:be.roots.organisation?level=INFO" />
<!-- TODO: send it to the webservice -->
</idempotentConsumer>
</filter>
</route>

This seems to work as expected :-)

Cheers,
Tom

Tom Fornoville
Senior Developer
m: +32 478 65 86 51
www.roots.be


On Wed, Aug 7, 2013 at 3:46 AM, saltnlight5 [via Camel] <
ml-node+s465427n5736874...@n5.nabble.com> wrote:

> Hello Tom,
>
> I think you can try flatpack with one of the idempotent consumer (
> http://camel.apache.org/idempotent-consumer.html) to eliminate duplicated
> messages. For example, maybe something like this:
>
>   from("file:inbox")
>     .to("flatpack:fixed:yourdata.pzmap.xml")
>     .filter(header("action_id"))
>     .idempotentConsumer(header("organisation_id"),
> MemoryIdempotentRepository.memoryIdempotentRepository(200))
>
> Also alternative to flatpack, you may also checkout Camel bindy:
> http://camel.apache.org/bindy.html to parse fixed length records.
>
> Have fun,
> Zemian
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://camel.465427.n5.nabble.com/Flatpack-and-aggregation-tp5736837p5736874.html
>  To unsubscribe from Flatpack and aggregation, click 
> here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5736837&code=dG9tLmZvcm5vdmlsbGVAcm9vdHMuYmV8NTczNjgzN3wxNzA0MjEyMTky>
> .
> NAML<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: 
http://camel.465427.n5.nabble.com/Flatpack-and-aggregation-tp5736837p5736914.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to