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: Split Body in Spring DSL
Date Thu, 22 Apr 2010 12:26:38 GMT
On Wed, Apr 21, 2010 at 9:23 PM, Olivier Roger <olivier.roger@bsb.com> wrote:
>
> I understand the better now,
>
> Anyways, this would really be a useful features in our case :)
>

I have fixed the <simple>body</simple> and <simple>${body}</simple>
now returning the same = the body instance as it is.

>
> Claus Ibsen-2 wrote:
>>
>> Hi
>>
>> Yeah I can see the problem now.
>>
>> The <simple> language was originally designed for creating dynamic
>> Strings, and hence ${body} is parsed as "" + body, which cause Camel
>> to type coerce the body to a String type as well.
>>
>> I will look into this.
>>
>> On Mon, Apr 19, 2010 at 9:28 AM, Olivier Roger <olivier.roger@bsb.com>
>> wrote:
>>>
>>> Hello Claus,
>>>
>>> I was using the tokenize on "]," but some brackets from the toString
>>> representation where still present in the result, which is normal.
>>>
>>> Using <simple>${body}</simple> seems indeed to be what I was looking
for.
>>> However, at the moment when I used it, the splitter return 1 message per
>>> cell instead of per row.
>>>
>>> So a 5 line, with 5 line per row, document is split into 25 messages.
>>>
>>> Is there a way to force change this behavior ?
>>>
>>> Thanks,
>>>
>>> Olivier
>>>
>>>
>>> Claus Ibsen-2 wrote:
>>>>
>>>> Hi
>>>>
>>>> Yeah the split EIP pattern will be explained in chapter 8 in both Java
>>>> and Spring XML examples.
>>>>
>>>> You can also see a bit more here
>>>> http://camel.apache.org/splitter.html
>>>>
>>>> You use the <tokenize/> and it requires a token, such as \n or comma
>>>> etc.
>>>> <tokenize token="\n"/>
>>>>
>>>> To do the exact same example as in Java DSL you can do
>>>> <simple>${body}</simple>
>>>>
>>>> To let Camel "figure out" based on the Body and split it. Since the
>>>> Body is most likely a List or the likes, then Camel
>>>> will iterate the list in the splitting.
>>>>
>>>>
>>>>
>>>> On Sun, Apr 18, 2010 at 8:28 PM, Olivier Roger <olivier.roger@bsb.com>
>>>> wrote:
>>>>>
>>>>> Hello Camel!
>>>>>
>>>>> I am currently reading the "Camel in Action" book, where I found an
>>>>> example
>>>>> to unmarshal a csv file.
>>>>>
>>>>> The example is in Java DSL and I can't found the similar Spring DSL
>>>>> expression to .split(body())
>>>>>
>>>>> The full Java example is
>>>>>
>>>>> .from("...").unmarchal().csv().split(body()).to("...");
>>>>>
>>>>> Here is my Spring DSL route
>>>>>
>>>>>                <route>
>>>>>                        <from uri="direct:csv" />
>>>>>                        <unmarshal><csv /></unmarshal>
>>>>>                        <split>
>>>>>                                <??? />
>>>>>                                <to uri="mock:csv"
/>
>>>>>                        </split>
>>>>>                </route>
>>>>>
>>>>> Thanks in advance for your help !
>>>>>
>>>>> Olivier
>>>>> --
>>>>> View this message in context:
>>>>> http://old.nabble.com/Split-Body-in-Spring-DSL-tp28284152p28284152.html
>>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Claus Ibsen
>>>> Apache Camel Committer
>>>>
>>>> Author of Camel in Action: http://www.manning.com/ibsen/
>>>> Open Source Integration: http://fusesource.com
>>>> Blog: http://davsclaus.blogspot.com/
>>>> Twitter: http://twitter.com/davsclaus
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://old.nabble.com/Split-Body-in-Spring-DSL-tp28284152p28287615.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Author of Camel in Action: http://www.manning.com/ibsen/
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>>
>>
>
> --
> View this message in context: http://old.nabble.com/Split-Body-in-Spring-DSL-tp28284152p28294993.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Mime
View raw message