Re: CamelTestSupport Import

2013-07-11 Thread Bovas
Thanks for your answer Wiliem

yeah I have imported camel-core and camel-context, JUnit 4 library

but I found my error, I imported a library which was in conflict with other.









-
regards,
Bovas
--
View this message in context: 
http://camel.465427.n5.nabble.com/CamelTestSupport-Import-tp5735452p5735512.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: CSV files processing

2013-07-11 Thread Joe San
The problem is that I cannot rely on that file name. I have to rely on the
content. The first line in the CSV file will always contain what is being
exported with the field names. This set of field names are finite. I can of
course hard code that comma seperated field names in a string and compare
them. But is there a better approach like we do for an xml using xpath?

Regards,
Joe


On Thu, Jul 11, 2013 at 8:22 AM, Claus Ibsen  wrote:

> If you pickup files using the file component, then the message headers
> contains file name information.
> http://camel.apache.org/file2
>
>
>
> On Wed, Jul 10, 2013 at 7:07 PM, Jothi  wrote:
> > Is there a way to find out which CSV file that is currently being
> processed?
> > I mean I have a couple of CSV files and I do not know the name of those
> CSV
> > files. All I know is their structure. If it was XML, I can identify the
> file
> > structure using xpath. Is there something similar that I can do for CSV
> > files? The first line always contains the name of the fields. Of course I
> > can hard code the fields and do a string comparison, but I feel this to
> be a
> > bit ugly. Is there an elegant way?
> >
> > Regards,
> > Joe
> >
> >
> >
> > --
> > View this message in context:
> http://camel.465427.n5.nabble.com/CSV-files-processing-tp5735470.html
> > Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
>
> --
> Claus Ibsen
> -
> Red Hat, Inc.
> Email: cib...@redhat.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
>


Re: Extract the name of the Method from a Bean invokation.

2013-07-11 Thread Claus Ibsen
Hi

Ah yeah the null safe doesn't apply for methods not found.
I am not sure if this is a good idea to add support for that. As if
you have a typo in the method name, then the null safe will ignore
that also.

And adding more stuff to the syntax would just confuse even more, eg

For example with a double ?? to indicate ignore method not found.

${body??.method??.name}

The ? is null safe, so its if the getMethod returns null, then break
out of the OGNL path.





On Wed, Jul 10, 2013 at 7:01 PM, Cristiano Costantini
 wrote:
> ,
> I would need exactly that, but I've tested sending a string with a producer
> template and I got this error:
>
> Failed to invoke method: ?.method?.name on null due to:
> org.apache.camel.language.bean.RuntimeBeanExpressionException: Failed to
> invoke method: method on null due to:
> org.apache.camel.component.bean.MethodNotFoundException: Method with name:
> method not found on bean: Hello World! of type: java.lang.String.
> Exchange[Message: Hello World!]
>
> caused by
>
> Failed to invoke method: method on null due to:
> org.apache.camel.component.bean.MethodNotFoundException: Method with name:
> method not found on bean: Hello World! of type: java.lang.String.
> Exchange[Message: Hello World!]
>
>
> again caused by
>
>
> Method with name: method not found on bean: Hello World! of type:
> java.lang.String. Exchange[Message: Hello World!]
>
>
> I'm using camel 2.10.4...
> Any suggestion?
>
> Thanks,
> Cristiano
>
>
>
>
>
>
> 2013/7/10 Claus Ibsen 
>
>> There is a ? operator, so you can do
>>
>> ${body?.method?.name
>>
>> Then it will be null if the body if the body doesnt have a
>> getMethod().getName()
>>
>> There is also a bodyAs(type) to use the Camel type converter.
>>
>>
>>
>> On Wed, Jul 10, 2013 at 4:48 PM, Cristiano Costantini
>>  wrote:
>> > mmm, it seems that "${body.method.name}" works:
>> >
>> > 
>> > ${body.method.name}
>> > 
>> >
>> >
>> > Any comment about this solution? (is it good?)
>> >
>> > What happens if the body is not of class
>> > org.apache.camel.component.bean.BeanInvocation?
>> > Is there a way to check if body is of the right instance?
>> >
>> > Many thanks!!!
>> >
>> > Cristiano
>> >
>> >
>> >
>> >
>> >
>> > 2013/7/10 Cristiano Costantini 
>> >
>> >> Hi All,
>> >>
>> >> I have a Camel Proxy that pushes "BeanInvokation" exchanges  to a camel
>> >> route, and I want to route these messages depending on the method name
>> that
>> >> is invoked.
>> >>
>> >> Is there any way to extract this information and put into an header so
>> to
>> >> use it in a ?
>> >>
>> >>
>> >> For example, considering the following XML code:
>> >>
>> >> http://camel.apache.org/schema/spring";>
>> >> > >>  serviceUrl="direct:entry" />
>> >>
>> >> 
>> >> 
>> >>  
>> >>  
>> >>  
>> >>
>> >> 
>> >> 
>> >>  ${header.methodName} == 'myMethod1'
>> >> 
>> >>  
>> >> 
>> >> ${header.methodName} == 'myMethod2'
>> >>  
>> >> 
>> >> 
>> >>  
>> >> 
>> >> 
>> >>  
>> >> 
>> >>
>> >>
>> >> I'm searching for a solution to be used between the two 
>> tags.
>> >>
>> >> I know I can write a processor, but I will have problems deploying it to
>> >> the classpath where I put the route, so I need a solution that rely on
>> the
>> >> default camel capability (like using simple language or other expression
>> >> languages available with camel).
>> >>
>> >>
>> >> Any idea?
>> >> Thank you all!
>> >>
>> >> Cristiano
>> >>
>> >>
>> >>
>>
>>
>>
>> --
>> Claus Ibsen
>> -
>> Red Hat, Inc.
>> Email: cib...@redhat.com
>> Twitter: davsclaus
>> Blog: http://davsclaus.com
>> Author of Camel in Action: http://www.manning.com/ibsen
>>



-- 
Claus Ibsen
-
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


Exceptions when aggregating messages

2013-07-11 Thread cristisor
Hello,

I'm trying to aggregate a bunch of messages, each containing a String as
body, the In message from each exchange that comes to the aggregator, so
that I can send only one exchange containing the list of strings to the next
route in the end.

If I set the body as a List the send operation
fails with the following:
NotSerializableException: org.apache.camel.impl.DefaultMessage

This is understandable since Message is not serializable, but then I tried
aggregating a list List where MessageBean implements the
Serializable interface and contains the body(String), the
header(CaseInsensitiveMap) and properties(CaseInsensitiveMap). This time the
exception is different:
NotSerializableException: org.apache.camel.component.file.GenericFile

Can someone spot the problem? I could aggregated the complete exchanges and
send them, but isn't the overhead too big?



--
View this message in context: 
http://camel.465427.n5.nabble.com/Exceptions-when-aggregating-messages-tp5735523.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Extract the name of the Method from a Bean invokation.

2013-07-11 Thread Cristiano Costantini
Hi Claus,
thanks again,

yes I understand the problem, and I agree that the Simple language should
be simple !

While for my specific case, I've found that it exists an "is" operator in
simple language to test instanceof :
${in.header.type} is 'java.lang.String'

I can use it to check if the body is an instance of BeanInvocation, then
use the ?. operator, else route the message somewhere else.

For example I can change the original XML route in this way (it is a bit
verbose but I hope it should work):

http://camel.apache.org/schema/spring
">






${body} is 'org.apache.camel.component.bean.BeanInvocation'











${body?.method?.name}



${header.methodName} == 'myMethod1'



${header.methodName} == 'myMethod2'










Please note that I've not tested yet the above route!!
And again, any improvement is welcome. ;-)

Cristiano










2013/7/11 Claus Ibsen 

> Hi
>
> Ah yeah the null safe doesn't apply for methods not found.
> I am not sure if this is a good idea to add support for that. As if
> you have a typo in the method name, then the null safe will ignore
> that also.
>
> And adding more stuff to the syntax would just confuse even more, eg
>
> For example with a double ?? to indicate ignore method not found.
>
> ${body??.method??.name}
>
> The ? is null safe, so its if the getMethod returns null, then break
> out of the OGNL path.
>
>
>
>
>
> On Wed, Jul 10, 2013 at 7:01 PM, Cristiano Costantini
>  wrote:
> > ,
> > I would need exactly that, but I've tested sending a string with a
> producer
> > template and I got this error:
> >
> > Failed to invoke method: ?.method?.name on null due to:
> > org.apache.camel.language.bean.RuntimeBeanExpressionException: Failed to
> > invoke method: method on null due to:
> > org.apache.camel.component.bean.MethodNotFoundException: Method with
> name:
> > method not found on bean: Hello World! of type: java.lang.String.
> > Exchange[Message: Hello World!]
> >
> > caused by
> >
> > Failed to invoke method: method on null due to:
> > org.apache.camel.component.bean.MethodNotFoundException: Method with
> name:
> > method not found on bean: Hello World! of type: java.lang.String.
> > Exchange[Message: Hello World!]
> >
> >
> > again caused by
> >
> >
> > Method with name: method not found on bean: Hello World! of type:
> > java.lang.String. Exchange[Message: Hello World!]
> >
> >
> > I'm using camel 2.10.4...
> > Any suggestion?
> >
> > Thanks,
> > Cristiano
> >
> >
> >
> >
> >
> >
> > 2013/7/10 Claus Ibsen 
> >
> >> There is a ? operator, so you can do
> >>
> >> ${body?.method?.name
> >>
> >> Then it will be null if the body if the body doesnt have a
> >> getMethod().getName()
> >>
> >> There is also a bodyAs(type) to use the Camel type converter.
> >>
> >>
> >>
> >> On Wed, Jul 10, 2013 at 4:48 PM, Cristiano Costantini
> >>  wrote:
> >> > mmm, it seems that "${body.method.name}" works:
> >> >
> >> > 
> >> > ${body.method.name}
> >> > 
> >> >
> >> >
> >> > Any comment about this solution? (is it good?)
> >> >
> >> > What happens if the body is not of class
> >> > org.apache.camel.component.bean.BeanInvocation?
> >> > Is there a way to check if body is of the right instance?
> >> >
> >> > Many thanks!!!
> >> >
> >> > Cristiano
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > 2013/7/10 Cristiano Costantini 
> >> >
> >> >> Hi All,
> >> >>
> >> >> I have a Camel Proxy that pushes "BeanInvokation" exchanges  to a
> camel
> >> >> route, and I want to route these messages depending on the method
> name
> >> that
> >> >> is invoked.
> >> >>
> >> >> Is there any way to extract this information and put into an header
> so
> >> to
> >> >> use it in a ?
> >> >>
> >> >>
> >> >> For example, considering the following XML code:
> >> >>
> >> >> http://camel.apache.org/schema/spring";>
> >> >>  >> >>  serviceUrl="direct:entry" />
> >> >>
> >> >> 
> >> >> 
> >> >>  
> >> >>  
> >> >>  
> >> >>
> >> >> 
> >> >> 
> >> >>  ${header.methodName} == 'myMethod1'
> >> >> 
> >> >>  
> >> >> 
> >> >> ${header.methodName} == 'myMethod2'
> >> >>  
> >> >> 
> >> >> 
> >> >>  
> >> >> 
> >> >> 
> >> >>  
> >> >> 
> >> >>
> >> >>
> >> >> I'm searching for a solution to be used between the two 
> >> tags.
> >> >>
> >> >> I know I can write a processor, but I will have problems deploying
> it to
> >> >> the classpath where I put the route, so I need a solution that rely
> on
> >> the
> >> >> default camel capability (like using simple language or other
> expression
> >> >> languages available with camel).
> >> >>
> >> >>
> >> >> Any idea?
> >> >> Thank you all!
> >> >>
> >> >> Cristiano
> >> >>
> >> >>
> >> >>
> >>
> >>
> >>
> >> --
> >> Claus Ibsen
> >> -
> >> Red Hat, Inc.
> >> Email: cib...@redhat.com
> >> Twitter: davsclaus
> >> Blog: http://davsclaus.com
> >> Author of Camel in Action: http://www.manning.com/ibsen
> >>
>
>
>
> --
> Claus Ibsen
> -
> Red Hat, Inc.
> Email: cib...@redhat.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Act

Re: Is onFinally() compulsory after doCatch()?

2013-07-11 Thread Claus Ibsen
Good idea, I updated the doc page with a tip about the end.

On Wed, Jul 3, 2013 at 6:01 AM, Tarun Kumar  wrote:
> Thanks Claus. This is not mentioned in
> http://camel.apache.org/try-catch-finally.html. I think it will be great if
> this can be added to that page. It will really help beginners like me.
>
>
> On Tue, Jul 2, 2013 at 11:46 PM, Claus Ibsen  wrote:
>
>> The end() marks when doCatch ends. So all the stuff in between is
>> inside the doCatch.
>>
>>
>>
>> On Tue, Jul 2, 2013 at 12:36 PM, Tarun Kumar 
>> wrote:
>> > Above link doesn't answer my second ques. Could you please help?
>> >
>> >
>> > On Tue, Jul 2, 2013 at 12:41 PM, Christian Müller <
>> > christian.muel...@gmail.com> wrote:
>> >
>> >> Check out the link I already sent to you [1].
>> >>
>> >> [1] http://camel.apache.org/try-catch-finally.html
>> >>
>> >> Best,
>> >> Christian
>> >> -
>> >>
>> >> Software Integration Specialist
>> >>
>> >> Apache Camel committer: https://camel.apache.org/team
>> >> V.P. Apache Camel: https://www.apache.org/foundation/
>> >> Apache Member: https://www.apache.org/foundation/members.html
>> >>
>> >> https://www.linkedin.com/pub/christian-mueller/11/551/642
>> >>
>> >>
>> >> On Tue, Jul 2, 2013 at 7:50 AM, Tarun Kumar > >> >wrote:
>> >>
>> >> > my route looks like this:
>> >> >
>> >> > from().
>> >> > .toTry().process()
>> >> > .doCatch(Exception.class)
>> >> > .to().to().process()
>> >> > .end()
>> >> >
>> >> >
>> >> > My questions are:
>> >> >
>> >> > 1. is .doFinally compulsory after doCatch()?
>> >> > 2. In my case, how does route know whether second .to() in line 4 is
>> >> inside
>> >> > doCatch() or after doCatch()?
>> >> > 3. I am using cxfrs component, why is my exchange body not being
>> returned
>> >> > back to caller. Caller is seeing 204 no content found. While, when i
>> >> remove
>> >> > doTry and doCatch() with same code, caller is able to see proper
>> response
>> >> > (exchange body, status and all). Why is that?
>> >> >
>> >>
>>
>>
>>
>> --
>> Claus Ibsen
>> -
>> www.camelone.org: The open source integration conference.
>>
>> Red Hat, Inc.
>> FuseSource is now part of Red Hat
>> Email: cib...@redhat.com
>> Web: http://fusesource.com
>> Twitter: davsclaus
>> Blog: http://davsclaus.com
>> Author of Camel in Action: http://www.manning.com/ibsen
>>



-- 
Claus Ibsen
-
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


Re: CSV files processing

2013-07-11 Thread gquintana
XPath is the language to walk through the XML Dom Tree. Either you treat the
file as a String and use String operations ( Simple
   as contains and regex operations).
Or you treat the file as Java object tree (after unmarshalling) and walk
through the Java object tree (an expression language like  Simple
   can do that).



--
View this message in context: 
http://camel.465427.n5.nabble.com/CSV-files-processing-tp5735470p5735527.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Netty-http

2013-07-11 Thread Nico Sommi
Hello, this is a basic question but I need to check it before doing it,
Does anybody know why the camel-netty-http component isn't uploaded on the
maven repo?
At least I cannot find it... even searching for
"camel-netty-http-2.6.0.jar" (for example) in google
Here is the camel archifact root on one maven repo:
http://mvnrepository.com/artifact/org.apache.camel

Building from source is the only way to get it?
https://github.com/apache/camel/tree/master/components/camel-netty-http

Thanks

Nico Sommi
Por favor considere el medio ambiente antes de imprimir este correo.
Please consider the environment before printing this email.


Re: Netty-http

2013-07-11 Thread Claus Ibsen
Its a new component in the upcoming Camel 2.12.0 release. So the
answer is that it's not been released yet.

Its also noted on its documentation page in the top
http://camel.apache.org/netty-http

Each component lists in which version they were added.

On Thu, Jul 11, 2013 at 6:06 PM, Nico Sommi  wrote:
> Hello, this is a basic question but I need to check it before doing it,
> Does anybody know why the camel-netty-http component isn't uploaded on the
> maven repo?
> At least I cannot find it... even searching for
> "camel-netty-http-2.6.0.jar" (for example) in google
> Here is the camel archifact root on one maven repo:
> http://mvnrepository.com/artifact/org.apache.camel
>
> Building from source is the only way to get it?
> https://github.com/apache/camel/tree/master/components/camel-netty-http
>
> Thanks
>
> Nico Sommi
> Por favor considere el medio ambiente antes de imprimir este correo.
> Please consider the environment before printing this email.



-- 
Claus Ibsen
-
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


Re: Netty-http

2013-07-11 Thread Nico Sommi
Ah ok, I read the component page but not I was not aware of the current
camel release.
Thank you!

Nico Sommi
Por favor considere el medio ambiente antes de imprimir este correo.
Please consider the environment before printing this email.


2013/7/11 Claus Ibsen 

> Its a new component in the upcoming Camel 2.12.0 release. So the
> answer is that it's not been released yet.
>
> Its also noted on its documentation page in the top
> http://camel.apache.org/netty-http
>
> Each component lists in which version they were added.
>
> On Thu, Jul 11, 2013 at 6:06 PM, Nico Sommi  wrote:
> > Hello, this is a basic question but I need to check it before doing it,
> > Does anybody know why the camel-netty-http component isn't uploaded on
> the
> > maven repo?
> > At least I cannot find it... even searching for
> > "camel-netty-http-2.6.0.jar" (for example) in google
> > Here is the camel archifact root on one maven repo:
> > http://mvnrepository.com/artifact/org.apache.camel
> >
> > Building from source is the only way to get it?
> > https://github.com/apache/camel/tree/master/components/camel-netty-http
> >
> > Thanks
> >
> > Nico Sommi
> > Por favor considere el medio ambiente antes de imprimir este correo.
> > Please consider the environment before printing this email.
>
>
>
> --
> Claus Ibsen
> -
> Red Hat, Inc.
> Email: cib...@redhat.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
>


RE: Bindy Date Pattern Error

2013-07-11 Thread ganeshkumar.kanagavel
Hi,
We are using camel version 2.11

Our data format is in the format of YYMMDD , Unmarshalling is failing if we use 
java.sql.date but works with java.util.date.

But java.util.date is not compliant with sql server database insert, so we need 
to add some conversion logic in the get method of the Model.

Thanks
Ganesh

-Original Message-
From: Christian Müller [mailto:christian.muel...@gmail.com] 
Sent: Tuesday, July 09, 2013 4:32 PM
To: users@camel.apache.org
Subject: Re: Bindy Date Pattern Error

How dos your date looks like?
Which version of Camel do you use?
I added an unit test to 2.12-SNAPSHOT [1] which show does it works (at least 
with this version).

[1]
https://git-wip-us.apache.org/repos/asf?p=camel.git;a=blob;f=components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/date/BindyDatePatternCsvUnmarshallTest.java;h=71184cef4acce98a3bfe36c32efd574b5f7d00f1;hb=HEAD

Best,
Christian
-

Software Integration Specialist

Apache Camel committer: https://camel.apache.org/team V.P. Apache Camel: 
https://www.apache.org/foundation/
Apache Member: https://www.apache.org/foundation/members.html

https://www.linkedin.com/pub/christian-mueller/11/551/642


On Tue, Jul 9, 2013 at 8:31 PM,  wrote:

> Hi,
> Can you please advise regarding Date Pattern exception in Bindy.
>
> We are using Bindy to marshal, We have a attribute with data type as DATE.
>
> We are getting the below exception during the parsing.
>
> java.lang.IllegalArgumentException: Can not find a suitable formatter 
> for the type: java.sql.Date Annotation model snippet is below.
>
> @DataField(pos=41, length=10,pattern="MM-dd-")
>   private Date settlement_date;
> Thanks
> Ganesh
>
>
>
>
>
> ___
>
> This message is for information purposes only, it is not a 
> recommendation, advice, offer or solicitation to buy or sell a product 
> or service nor an official confirmation of any transaction. It is 
> directed at persons who are professionals and is not intended for 
> retail customer use. Intended for recipient only. This message is subject to 
> the terms at:
> www.barclays.com/emaildisclaimer.
>
> For important disclosures, please see:
> www.barclays.com/salesandtradingdisclaimer regarding market commentary 
> from Barclays Sales and/or Trading, who are active market 
> participants; and in respect of Barclays Research, including 
> disclosures relating to specific issuers, please see 
> http://publicresearch.barclays.com.
>
> ___
>
___

This message is for information purposes only, it is not a recommendation, 
advice, offer or solicitation to buy or sell a product or service nor an 
official confirmation of any transaction. It is directed at persons who are 
professionals and is not intended for retail customer use. Intended for 
recipient only. This message is subject to the terms at: 
www.barclays.com/emaildisclaimer.

For important disclosures, please see: 
www.barclays.com/salesandtradingdisclaimer regarding market commentary from 
Barclays Sales and/or Trading, who are active market participants; and in 
respect of Barclays Research, including disclosures relating to specific 
issuers, please see http://publicresearch.barclays.com.

___


doneFileName in different Directory Possibility

2013-07-11 Thread ganeshkumar.kanagavel
Hi,
Please advise if we have a option to look for doneFileName in the different 
directory than the Original File Name?

We have a requirement to look for the Ready file in a directory and pick up the 
data file from a directory.

Thanks
Ganesh

___

This message is for information purposes only, it is not a recommendation, 
advice, offer or solicitation to buy or sell a product or service nor an 
official confirmation of any transaction. It is directed at persons who are 
professionals and is not intended for retail customer use. Intended for 
recipient only. This message is subject to the terms at: 
www.barclays.com/emaildisclaimer.

For important disclosures, please see: 
www.barclays.com/salesandtradingdisclaimer regarding market commentary from 
Barclays Sales and/or Trading, who are active market participants; and in 
respect of Barclays Research, including disclosures relating to specific 
issuers, please see http://publicresearch.barclays.com.

___


Re: doneFileName in different Directory Possibility

2013-07-11 Thread Claus Ibsen
Hi

If you see the docs you can find your answer
http://camel.apache.org/file2

On Thu, Jul 11, 2013 at 6:31 PM,   wrote:
> Hi,
> Please advise if we have a option to look for doneFileName in the different 
> directory than the Original File Name?
>
> We have a requirement to look for the Ready file in a directory and pick up 
> the data file from a directory.
>
> Thanks
> Ganesh
>
> ___
>
> This message is for information purposes only, it is not a recommendation, 
> advice, offer or solicitation to buy or sell a product or service nor an 
> official confirmation of any transaction. It is directed at persons who are 
> professionals and is not intended for retail customer use. Intended for 
> recipient only. This message is subject to the terms at: 
> www.barclays.com/emaildisclaimer.
>
> For important disclosures, please see: 
> www.barclays.com/salesandtradingdisclaimer regarding market commentary from 
> Barclays Sales and/or Trading, who are active market participants; and in 
> respect of Barclays Research, including disclosures relating to specific 
> issuers, please see http://publicresearch.barclays.com.
>
> ___



-- 
Claus Ibsen
-
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


Re: Mocking consumer endpoints

2013-07-11 Thread Claus Ibsen
No there is not.

On Mon, Jul 1, 2013 at 6:55 PM, Bilgin Ibryam  wrote:
> Hi,
>
> with CamelTestSupport I can use isMockEndpointsAndSkip method to mock
> existing endpoints, but for mocking the consumer endpoint I still have to
> use AdviceWithRouteBuilder.
>
> Is there a method in CamelTestSupport that I can override and mock the
> consumer endpoints?
>
> Thanks
> Bilgin



-- 
Claus Ibsen
-
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


Using Bindy for multiple record types in the same file

2013-07-11 Thread rodrickmusser
I am wondering if Bindy can be used in the following scenario:

The file format I am working with is fixed length.  The first two characters
indicate the record type.  For example, "01" indicates an order record, "02"
indicates a customer record.  If the record is an order record, characters
2-11 are the order id.  If the record is a customer record, characters 2-20
is the customer name.

How does Bindy handle this situation?



--
View this message in context: 
http://camel.465427.n5.nabble.com/Using-Bindy-for-multiple-record-types-in-the-same-file-tp5735541.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Exceptions when aggregating messages

2013-07-11 Thread Christian Posta
Post your code if you could, and I can help take a look.


On Thu, Jul 11, 2013 at 7:42 AM, cristisor  wrote:

> Hello,
>
> I'm trying to aggregate a bunch of messages, each containing a String as
> body, the In message from each exchange that comes to the aggregator, so
> that I can send only one exchange containing the list of strings to the
> next
> route in the end.
>
> If I set the body as a List the send operation
> fails with the following:
> NotSerializableException: org.apache.camel.impl.DefaultMessage
>
> This is understandable since Message is not serializable, but then I tried
> aggregating a list List where MessageBean implements the
> Serializable interface and contains the body(String), the
> header(CaseInsensitiveMap) and properties(CaseInsensitiveMap). This time
> the
> exception is different:
> NotSerializableException: org.apache.camel.component.file.GenericFile
>
> Can someone spot the problem? I could aggregated the complete exchanges and
> send them, but isn't the overhead too big?
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Exceptions-when-aggregating-messages-tp5735523.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
*Christian Posta*
http://www.christianposta.com/blog
twitter: @christianposta


Re: Camel Test Hierarchy is inconsistent

2013-07-11 Thread Christian Müller
cmueller$ mvn dependency:tree
[INFO] Scanning for projects...
[INFO]
[INFO]

[INFO] Building Camel :: Test 2.11.0
[INFO]

[INFO]
[INFO] --- maven-dependency-plugin:2.6:tree (default-cli) @ camel-test ---
[INFO] org.apache.camel:camel-test:bundle:2.11.0
[INFO] +- org.apache.camel:camel-core:jar:2.11.0:compile
[INFO] |  \- org.slf4j:slf4j-api:jar:1.6.6:compile (version managed from
1.6.6)
[INFO] +- junit:junit:jar:4.11:compile
[INFO] |  \- org.hamcrest:hamcrest-core:jar:1.3:compile
[INFO] \- org.slf4j:slf4j-log4j12:jar:1.7.5:test
[INFO]\- log4j:log4j:jar:1.2.17:test (version managed from 1.2.17)
[INFO]

[INFO] BUILD SUCCESS
[INFO]

[INFO] Total time: 1.771s
[INFO] Finished at: Thu Jul 11 23:00:07 CEST 2013
[INFO] Final Memory: 9M/81M
[INFO]


Best,
Christian
-

Software Integration Specialist

Apache Camel committer: https://camel.apache.org/team
V.P. Apache Camel: https://www.apache.org/foundation/
Apache Member: https://www.apache.org/foundation/members.html

https://www.linkedin.com/pub/christian-mueller/11/551/642


On Wed, Jul 10, 2013 at 10:31 AM, Bovas  wrote:

> Hi everybody,
>
> I use Camel 2.11, Java DSL.
> I would like to use Camel Test, but I have a problem.
>
> /import org.apache.camel.test.junit4.CamelTestSupport;
>
> public class TestCamelProcess extends CamelTestSupport {
> ...}/
>
> => The hierarchy of TestCamelProcess is inconsistent.
> The error is occur in the class - class x, x inherits y, and in turn, y
> inherits z. However, the compiler cannot resolve z, because z is belong to
> a
> library that is not included.
>
> I have include camel-test-2.11.0.jar
> I forgot some imports?
>
>
>
>
> -
> regards,
> Bovas
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Camel-Test-Hierarchy-is-inconsistent-tp5735413.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


Accessing a local declared hashmap variable in a route

2013-07-11 Thread clipod
Hi, 
I have a camel route with a choice block. I want to use a hashmap inside a
when condition. 
To be more precise I would like to know if there is a way to use the
"containsKey" function inside when.
Is there a way to handle this. I can actually create a processor and define
the behaviour but I would like to do it in the route itself.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Accessing-a-local-declared-hashmap-variable-in-a-route-tp5735553.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Using Bindy for multiple record types in the same file

2013-07-11 Thread Willem jiang
I think you can split the file and routing the lines to different bindy data 
format base on the first 2 character.


--  
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) 
(English)
  http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem





On Friday, July 12, 2013 at 2:59 AM, rodrickmusser wrote:

> I am wondering if Bindy can be used in the following scenario:
>  
> The file format I am working with is fixed length. The first two characters
> indicate the record type. For example, "01" indicates an order record, "02"
> indicates a customer record. If the record is an order record, characters
> 2-11 are the order id. If the record is a customer record, characters 2-20
> is the customer name.
>  
> How does Bindy handle this situation?
>  
>  
>  
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Using-Bindy-for-multiple-record-types-in-the-same-file-tp5735541.html
> Sent from the Camel - Users mailing list archive at Nabble.com 
> (http://Nabble.com).





Re: Using pre-allocated Exchange with Proxy

2013-07-11 Thread Tim Jones
Hi Lars,

did you come up with a solution for this problem? I am also interested in
being able to add additional message headers to the Exchange while using a
ProxyBuilder.


Regards,

Tim



--
View this message in context: 
http://camel.465427.n5.nabble.com/Using-pre-allocated-Exchange-with-Proxy-tp5732587p5735558.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Exceptions when aggregating messages

2013-07-11 Thread cristisor
Hello and thank you for your reply.


This is the code for aggregating the whole camel message:
class ObjectsAggregationStrategy implements AggregationStrategy {

final Logger logger =
Logger.getLogger(ObjectsAggregationStrategy.class);

@SuppressWarnings("unchecked")
@Override
public Exchange aggregate(Exchange oldExchange, Exchange
newExchange) {
List items;
if (oldExchange == null) {
items = new ArrayList();
items.add(newExchange.getIn());
Exchange copyExchange = newExchange.copy();
copyExchange.getIn().setBody(items);
return copyExchange;
}

items = oldExchange.getIn().getBody(List.class);
Message newItem = newExchange.getIn();
items.add(newItem);
oldExchange.getIn().setBody(items);

Exchange finalExchange = updateInMessageHeaders(oldExchange,
newExchange);
finalExchange = updateExchangeProperties(oldExchange,
newExchange);

return finalExchange;
}

private Exchange updateExchangeProperties(Exchange oldExchange,
Exchange newExchange) {
CaseInsensitiveMap properties = new
CaseInsensitiveMap(newExchange.getProperties());

for (Entry entry : properties.entrySet()) {
oldExchange.setProperty(entry.getKey(), entry.getValue());
}

return oldExchange;
}

private Exchange updateInMessageHeaders(Exchange oldExchange,
Exchange newExchange) {
CaseInsensitiveMap headers = new
CaseInsensitiveMap(newExchange.getIn().getHeaders());

for (Entry entry : headers.entrySet()) {
if
(entry.getKey().equals(MessageConstant.ERES_FILE_COMPLETE) &&
entry.getValue().equals(Boolean.TRUE)) {
logger.debug("Received and set the ERES_FILE_COMPLETE
header from routeId["
+ oldExchange.getFromRouteId() + "].");
}
oldExchange.getIn().setHeader(entry.getKey(),
entry.getValue());
}

return oldExchange;
}
}


And this is the code for aggregating a serializable custom bean:
public class MessageAggregationStrategy implements AggregationStrategy {
final Logger logger =
Logger.getLogger(MessageAggregationStrategy.class);

@SuppressWarnings("unchecked")
@Override
public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
MessageBean bean = setExchangeData(newExchange);
List> items;
if (oldExchange == null) {
items = new ArrayList>();
items.add(bean);
Exchange copyExchange = newExchange.copy();
copyExchange.getIn().setBody(items);
return copyExchange;
}

items = oldExchange.getIn().getBody(List.class);
items.add(bean);
oldExchange.getIn().setBody(items);

return oldExchange;
}

@SuppressWarnings("unchecked")
private MessageBean setExchangeData(Exchange exchange) {
MessageBean bean = new MessageBean();
bean.setBody((T) exchange.getIn().getBody());
bean.setHeaders(new
CaseInsensitiveMap(exchange.getIn().getHeaders()));
bean.setProperties(new
CaseInsensitiveMap(exchange.getProperties()));
return bean;
}


where MessageBean is:
public class MessageBean implements Serializable {
private static final long serialVersionUID = -987592973477513095L;
private T body;
private CaseInsensitiveMap properties;
private CaseInsensitiveMap headers;

public T getBody() {
return body;
}

public CaseInsensitiveMap getProperties() {
return properties;
}

public CaseInsensitiveMap getHeaders() {
return headers;
}

public void setBody(T body) {
this.body = body;
}

public void setProperties(CaseInsensitiveMap properties) {
this.properties = properties;
}

public void setHeaders(CaseInsensitiveMap headers) {
this.headers = headers;
}
}




--
View this message in context: 
http://camel.465427.n5.nabble.com/Exceptions-when-aggregating-messages-tp5735523p5735560.html
Sent from the Camel - Users mailing list archive at Nabble.com.