camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen" ...@silverbullet.dk>
Subject Flatpatch (was: RE: Component to read FixedLength file ?)
Date Wed, 16 Jul 2008 12:46:48 GMT
Hi

I see the current behaviour of the flatpack component is to create an exchange for each line
in the flatpack file.

What if you need only 1 exchange for the entire flatpack file? 
Before you say, you can use the aggregator, then yes but then I am not sure when the total
count so I can actually not aggregate them all. 

What if there was an option to specify if you want:
Option a) 1 exchange only with a List of Map with the data
Option b) as now 1 exchange pr. row with a Map as the data

The atom component has a similar feature where you can configure either option A or B.

With this option it's easier for end-users to get what they want. Also if possible we should
have a total row count on the message as a header option if possible. So you will now the
current sequence and the total number of rows, in the exchange you get.



Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: James Strachan [mailto:james.strachan@gmail.com] 
Sent: 15. juli 2008 20:52
To: camel-user@activemq.apache.org
Subject: Re: Component to read FixedLength file ?

FWIW I've just checked in a FlatpackDataFormat; which is a tad easier
to use. The downside is the data format kinda has to turn the DataSet
into a List of Maps to make it easier to work with; but at least the
routes are a bit simpler. e.g. this is from the
DelimitedWithUnmarshalTest (the convertBodyTo is not required
currently)

  <camelContext xmlns="http://activemq.apache.org/camel/schema/spring">
    <route>
      <from uri="file://src/test/data/delim?noop=true"/>
      <unmarshal ref="delimitedFormat"/>
      <splitter>
        <simple>in.body</simple>
        <convertBodyTo type="java.util.Map"/>
        <to uri="mock:results"/>
      </splitter>
    </route>
  </camelContext>

  <bean id="delimitedFormat"
class="org.apache.camel.component.flatpack.FlatpackDataFormat">
    <property name="definition" value="INVENTORY-Delimited.pzmap.xml"/>
  </bean>

2008/7/15 James Strachan <james.strachan@gmail.com>:
> Yeah - I did ponder if it should be a dataformat or a component; or
> maybe even both. The bit I wasn't sure about was flatpack really just
> provides an iterator over rows of the file; I wasn't sure if this
> properly matched the dataformat model of marshalling or unmarshalling
> a payload (which currently assumes that unmarshalling generates a
> single result).
>
> Maybe we need to enhance the dataformat concept to work with this use case too?
>
> So maybe if we want to process each row of a file we do something like...
>
> from("file://whatnot").
>  unmarshall().flatpack().fixed("locationOftheXMLConfigurationfile.pzmap.xml").
>  split().body().
>  to("whatever");
>
> where the split().body() would do the iteration over each DataSet?
>
>
> 2008/7/15 Claus Ibsen <ci@silverbullet.dk>:
>> Hi
>>
>> Yes I thought also at first it was a dataformat ;) But how James created it it works
as if it is a dataformat. You just have to do it in to..from from..to steps.
>>
>>
>> from("file://c:/test").to("flatpack:foo: locationOftheXMLConfigurationfile.pzmap.xml");
>>
>> from("flatpack:foo").to("whatever you want");
>>
>> As a component it gets more attention, as people can find it on the component list.
The dataformats are kinda hidden in the wiki documentation.
>> Maybe they need a "dataformat" top menu as well ;)
>>
>> Med venlig hilsen
>>
>> Claus Ibsen
>> ......................................
>> Silverbullet
>> Skovsgårdsvænget 21
>> 8362 Hørning
>> Tlf. +45 2962 7576
>> Web: www.silverbullet.dk
>>
>> -----Original Message-----
>> From: cmoulliard [mailto:cmoulliard@gmail.com]
>> Sent: 15. juli 2008 09:32
>> To: camel-user@activemq.apache.org
>> Subject: Re: Component to read FixedLength file ?
>>
>>
>> Many thanks.
>>
>> I will test the integration of this component within Camel.
>>
>> Remark : I'm a little confused about how Flatpack has been integrated. The
>> project has been integrated like a component but from my point of view, it
>> should be integrated (for consistency reason) like a Dataformat. Because
>> like the other framework/technology implemented in Camel (JAXB, Artix,
>> XStream, ....), they transform the content from a format (XML, CSV, ...)
>> into another format (Collection of Java objects)
>>
>> E.g.
>>
>> DataFormat flatpack = new
>> DataFormat("locationOftheXMLConfigurationfile.pzmap.xml.xml")
>>
>> from("file:///c:/test")
>> .unmarshall(flatpack)
>> .to("whatever you want")
>>
>> Regards,
>>
>> Charles
>>
>>
>>
>> James.Strachan wrote:
>>>
>>> BTW trunk has an early spike of a flatpack component. Needs more work,
>>> but there's a basic fixed-width reader example there for the curious
>>>
>>> 2008/7/14 James Strachan <james.strachan@gmail.com>:
>>>> I've raised a JIRA to track this...
>>>> https://issues.apache.org/activemq/browse/CAMEL-717
>>>>
>>>> 2008/7/14 James Strachan <james.strachan@gmail.com>:
>>>>> 2008/7/14 cmoulliard <cmoulliard@gmail.com>:
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> Is there a component expected to read fixedlength files in Camel
like
>>>>>> flatpack (http://flatpack.sourceforge.net/) allow to do it ?
>>>>>
>>>>> It should be pretty easy to write a flatpack component.
>>>>>
>>>>> there's a commercial tool called Artix Data Services which comes with
>>>>> a nice design UI that does this with Camel...
>>>>> http://activemq.apache.org/camel/artix-data-services.html
>>>>>
>>>>> but it'd be nice to have an OSS option :)
>>>>>
>>>>> --
>>>>> James
>>>>> -------
>>>>> http://macstrac.blogspot.com/
>>>>>
>>>>> Open Source Integration
>>>>> http://open.iona.com
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> James
>>>> -------
>>>> http://macstrac.blogspot.com/
>>>>
>>>> Open Source Integration
>>>> http://open.iona.com
>>>>
>>>
>>>
>>>
>>> --
>>> James
>>> -------
>>> http://macstrac.blogspot.com/
>>>
>>> Open Source Integration
>>> http://open.iona.com
>>>
>>>
>>
>>
>> -----
>> Enterprise Architect
>>
>> Xpectis
>> 12, route d'Esch
>> L-1470 Luxembourg
>>
>> Phone +352 25 10 70 470
>> Mobile +352 621 45 36 22
>>
>> e-mail : cmoulliard@xpectis.com
>> web site : www.xpectis.com
>> --
>> View this message in context: http://www.nabble.com/Component-to-read-FixedLength-file---tp18444614s22882p18459545.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
>
>
>
> --
> James
> -------
> http://macstrac.blogspot.com/
>
> Open Source Integration
> http://open.iona.com
>



-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com

Mime
View raw message