Re: Camel Spring Unit Testing with Mocks

2016-10-14 Thread Tomohisa Igarashi

I'm not sure if it's a bug or misuse, but expectedBodyReceived().body().isEqualTo("expected") 
doesn't work as expected. expectedBodiesReceived("expected") or 
expectedBodyReceived().constant("expected") works fine.
https://github.com/igarashitm/issues/blob/master/camel/misc/src/test/java/ExpectedBodyReceivedTest.java
only testBodyIsEqualTo() fails.

No idea yet for your second issue, but it sounds like the all endpoints are 
intercepted regardless of the RouteDefinition you invoked adviceWith().

Thanks,
Tomo

On 10/15/2016 02:06 AM, catequil wrote:

Ok, so it appears that I understand and have a working copy.  There are
however a few remaining questions.  If you feel they are no longer relevant
in this thread let me know and I will create a new thread.

In the code below I expected it to grab the "myRouteMiddle" route and find
the endpoint(direct:end) intercept it and mock the direct:end as
mock:direct:end.

In the assertions I expected it to to have a body of "peace world!", but the
test passed with a body of "hello world!".

Am I misunderstanding how the intercepts and/or getRouteDefinition work?

On a second issue I intercepted "log:input" and the test failed saying there
were 3 messages.  I expected it to only have one based on the following
criteria:
1. the "skipSendToOriginalEndpoint" should have stopped the last "log:input"
from being activated.
2. the getRouteDefinition was set to get "myMiddleRoute" which in my mind
should have gotten just the middle route and not the start route making the
total messages just 1.

Do you know why this works this way?  Is this a bug?  Or am I miss
understanding how it works?

Thanks





--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-Spring-Unit-Testing-with-Mocks-tp5788635p5788814.html
Sent from the Camel - Users mailing list archive at Nabble.com.



Re: Avro component example

2016-10-14 Thread Vitalii Tymchyshyn
We are using avro quite succesfully.

Чт, 13 жовт. 2016 07:25 користувач owain 
пише:

> Hi,
>
> Has anyone had any success converting a body (pojo) to an avro message via
> the avro component.  I have generated the avro serialiser for the avro
> message bit I am struggling with the documentation and questions online.  I
> am planning to send the avro message to some other routes via kakfa and
> avro
> seems like a good choice to reduce the coupling of the subsequent routes
> (services) on the domain model.
>
> I am using Blueprint.
>
> Thanks,
>
> O.
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Avro-component-example-tp5788728.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


Re: Looping in routes using Direct Component - Performance impact?

2016-10-14 Thread Vitalii Tymchyshyn
I think you would get into a recusion this way and end up with stack
overflow.
You should try http://camel.apache.org/dynamic-router.html

Best regards, Vitalii Tymchyshyn

13 жовт. 2016 р. 18:31 "Goyal, Arpit"  пише:

> Hi,
>
> We currently are on 2.16.3 version and can't use the loop function (part
> of 2.17). So we have the following routes based on which we create sort of
> loop with switch case. Now we are worried about the performance (when we
> see stacktrace of camel processing)
>
> Route 1:  from("direct:s1).to("read one page of data").process("process
> one page").to("direct:s2");
>
> Route 2:  from("direct:s2").toD("go to external source").when("are more
> pages left").to("direct:s1").otherwise().process("end processing");
>
> Now if there are thousands of pages, it is possible that this loop creates
> lot of objects in memory & can create performance issue? Is there a way for
> Camel to be told, before going to route 1 again, forget all the past? Is
> disabling HISTORY would solve that?
>
> Regards,
> Arpit.
>


Re: Apache Camel with Play Framework

2016-10-14 Thread Claus Ibsen
There is no play component from Apache Camel.

Its better to ask the play community if they have any kind of support
for Apache Camel.

However that said. Camel is just a Java library, so if play can run
any Java JARs then you can use Camel also. But you may need to write
some code to create CamelContext and what you need from Camel in play
framework. Where as if they have some kind of Camel component in play,
then that would likely do all this kind of work for you.

On Fri, Oct 14, 2016 at 8:13 AM, vinodkar87  wrote:
> Can we use apache Camel in Play framework?
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Apache-Camel-with-Play-Framework-tp5788760.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2


Re: Rest DSL with restlet Component, unable to access API when hosted on remote server

2016-10-14 Thread Claus Ibsen
What Camel version are you using?
And have you tried with a newer version?

Also its easy to try another rest component such as jetty or
netty4-http etc instead of restlet just to see if you can access on
that port then.

But the other suggestions about firewall and network is a very good
start to look also.

On Fri, Oct 14, 2016 at 2:59 PM, ganga_camel  wrote:
> Hi,I have a camel route with Rest DSL using the restlet component,
> configuration as listed
> belowrestConfiguration().component("restlet").host("{{hostname}}").port("{{port}}")
> .dataFormatProperty("prettyPrint", "true");
> rest("/books").consumes(MediaType.ALL.toString())
> .produces(MediaType.ALL.toString())
> .post().to("direct:ProcessData");When I run the camel service on my local
> machine with port as anything other than 8080(eg: 9091, 8081 etc), I am
> able successfully post to the Rest API.However, when I deploy the rest API
> code on the remote server to listen on port 9091 or 8081 etc... (anything
> other than port 8080), I am unable to post to the rest API. But am able to
> successfully post to rest API deployed on remote server when the port is set
> to 8080.This behavior is observed only when the rest API is deployed on
> remote host but works fine with any port number when rest API is running on
> the local machine.Any suggestions would be highly appreciated.Thanks,Ganga
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Rest-DSL-with-restlet-Component-unable-to-access-API-when-hosted-on-remote-server-tp5788789.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2


Re: Looping in routes using Direct Component - Performance impact?

2016-10-14 Thread Claus Ibsen
Hi

Yes if you loop 1000 times (or alot) then message history will take up
memory on the exchange as each step in the routes is recored by
default. You can turn this off
http://camel.apache.org/message-history.html

But as Brad says its not ideal to keep looping in Camel routes as they
are not intended to run forever/very long routes.

You can have higher performance from a java bean in a regular for loop
and then if needed use producer template to call a Camel route.





On Fri, Oct 14, 2016 at 12:31 AM, Goyal, Arpit  wrote:
> Hi,
>
> We currently are on 2.16.3 version and can't use the loop function (part of 
> 2.17). So we have the following routes based on which we create sort of loop 
> with switch case. Now we are worried about the performance (when we see 
> stacktrace of camel processing)
>
> Route 1:  from("direct:s1).to("read one page of data").process("process one 
> page").to("direct:s2");
>
> Route 2:  from("direct:s2").toD("go to external source").when("are more pages 
> left").to("direct:s1").otherwise().process("end processing");
>
> Now if there are thousands of pages, it is possible that this loop creates 
> lot of objects in memory & can create performance issue? Is there a way for 
> Camel to be told, before going to route 1 again, forget all the past? Is 
> disabling HISTORY would solve that?
>
> Regards,
> Arpit.



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2


Re: Looping in routes using Direct Component - Performance impact?

2016-10-14 Thread Brad Johnson
I didn't think you were appending the data.  But realize that when you call
direct or direct-vm it is a request/response style of route.  So you are
calling route 1 which calls route 2 which calls route 1 and are not
returning as far as I know.  So you are essentially making the equivalent
of a recursive method call.  You should end up with a stack overflow that
way eventually not because of the size of the individual messages but due
to the number of calls from 1 to 2 and 2 to 1 and 1 to 2 and so on.
Essentially you keep filling up the stack with each new call.

There is a chapter on the POJO approach in the Camel in Action book with
the same sort of recommendation.  All of chapter 4 is about it and one
section, for example, is called "using beans the easy way" and another
covers annotations. Hopefully in the new book (V2) they'll emphasize it a
bit more. Most of the time you don't need to specify the annotations if you
are passing a bean in the body that Camel can identify as the type and
method to invoke.  Otherwise you can annotate the method call and type with
@Body and if you need to pass in a header you use @Header.  If you want to
specify the method to call I think it's @Handler (can't be sure as I don't
use it most of the time).

http://camel.apache.org/bean.html
http://camel.apache.org/parameter-binding-annotations.html

On Fri, Oct 14, 2016 at 4:07 PM, Goyal, Arpit  wrote:

> Hi Brad,
>
> TOPIC 1:
> ---
> "StackOverflowError" - this is what happened with the current Route 2
> calling Route 1 for LARGE # OF PAGES. It was not about the data, because
> the body is not getting appended and is always limited to one page (at
> least in most cases).
>
> JVM/stack-size exploded around about 200 calls to the loop :) But yeah a
> good learning of what not to do :) Moved the Loop outside the route
> completely and based on Route 2 response, triggered the Route 1 again.
>
> Route 1 to Route 2 linkage was done only for modularization purpose.
>
> TOPIC 2:
> --
> Very interesting point you have raised here about using POJO and not
> Processors. I actually wanted to know is there some explanation of what you
> said in CAMEL IN ACTION book. Just got hand of hard-copy and see if I can
> understand that better.
>
> I did use split and bean binding, but not sure if that is the right POJO
> approach? I guess I should use @ExchangeProperty
> - public List splitMessage(@Body Object body, Exchange
> exchange)
>
> Current use cases which processor is doing:
> - set / get exchange headers (multiple)
> - set / get camel exchange property (so far single)
> - saw annotation ExchangeProperty, but it has String type return
> value. Whereas on exchange we are setting Objects.
>
> Regards,
> Arpit.
>
>
> -Original Message-
> From: Brad Johnson [mailto:brad.john...@mediadriver.com]
> Sent: Friday, October 14, 2016 8:54 AM
> To: users@camel.apache.org
> Subject: Re: Looping in routes using Direct Component - Performance impact?
>
> Have you looked at splitter/tokenizer/streaming for this instead of having
> route 1 call route 2 which calls route 1?  Interesting route setup as I've
> never used routes in a recursive fashion like that. When using direct the
> return doesn't happen until the end of the last route in the chain.  In
> this case it appears that you are continually delaying the return from the
> route via this iterative approach.  I'd have to check that via testing to
> see what's really happening in that case but I've never done it like that
> and would assume it would eventually run out of memory for large amounts of
> data.  As far as I know you can't just erase the history though you could
> set the body to null or empty string.  But I wouldn't do that.
>
> Just unmarshal your data and run it through the splitter in a streaming
> fashion.  If you don't need to process these in serial order you could then
> drop them on a SEDA queue with multiple consumer threads. You can then also
> set the queue size to limit how many documents are coming through at a
> time.
>
> Also, unless you have a compelling reason don't use Processors as they
> couple you to the framework. Just use a POJO and let Camel use reflection
> to select the correct method for processing or use annotations.  As a
> general rule of thumb I use, if you don't know exactly why you need to use
> a Processor you don't need to use it.
>
>
> On Thu, Oct 13, 2016 at 6:23 PM, Goyal, Arpit  wrote:
>
> > I can't compromise my business logic and there is hardly any data; but
> > each time camel Route 2 starts Route 1, the previous route processing
> goes
> > onto stack. I only have limited stack after that any operation can fail.
> >
> > To me below approach seems risky...I need to go async or remove the
> > looping out of the route overall.
> >
> > Regards,
> > Arpit.
> >
> > -Original Message-
> > From: souciance [mailto:souciance.eqdam.ras...@gmail.com]
> > Sent: Thursday, October 13, 2016 3:45 PM
> > To: users@

RE: Looping in routes using Direct Component - Performance impact?

2016-10-14 Thread Goyal, Arpit
Hi Brad,

TOPIC 1: 
---
"StackOverflowError" - this is what happened with the current Route 2 calling 
Route 1 for LARGE # OF PAGES. It was not about the data, because the body is 
not getting appended and is always limited to one page (at least in most cases).

JVM/stack-size exploded around about 200 calls to the loop :) But yeah a good 
learning of what not to do :) Moved the Loop outside the route completely and 
based on Route 2 response, triggered the Route 1 again. 

Route 1 to Route 2 linkage was done only for modularization purpose. 

TOPIC 2:
--
Very interesting point you have raised here about using POJO and not 
Processors. I actually wanted to know is there some explanation of what you 
said in CAMEL IN ACTION book. Just got hand of hard-copy and see if I can 
understand that better. 

I did use split and bean binding, but not sure if that is the right POJO 
approach? I guess I should use @ExchangeProperty 
- public List splitMessage(@Body Object body, Exchange 
exchange)

Current use cases which processor is doing: 
- set / get exchange headers (multiple)
- set / get camel exchange property (so far single)
- saw annotation ExchangeProperty, but it has String type return value. 
Whereas on exchange we are setting Objects. 

Regards,
Arpit.


-Original Message-
From: Brad Johnson [mailto:brad.john...@mediadriver.com] 
Sent: Friday, October 14, 2016 8:54 AM
To: users@camel.apache.org
Subject: Re: Looping in routes using Direct Component - Performance impact?

Have you looked at splitter/tokenizer/streaming for this instead of having
route 1 call route 2 which calls route 1?  Interesting route setup as I've
never used routes in a recursive fashion like that. When using direct the
return doesn't happen until the end of the last route in the chain.  In
this case it appears that you are continually delaying the return from the
route via this iterative approach.  I'd have to check that via testing to
see what's really happening in that case but I've never done it like that
and would assume it would eventually run out of memory for large amounts of
data.  As far as I know you can't just erase the history though you could
set the body to null or empty string.  But I wouldn't do that.

Just unmarshal your data and run it through the splitter in a streaming
fashion.  If you don't need to process these in serial order you could then
drop them on a SEDA queue with multiple consumer threads. You can then also
set the queue size to limit how many documents are coming through at a time.

Also, unless you have a compelling reason don't use Processors as they
couple you to the framework. Just use a POJO and let Camel use reflection
to select the correct method for processing or use annotations.  As a
general rule of thumb I use, if you don't know exactly why you need to use
a Processor you don't need to use it.


On Thu, Oct 13, 2016 at 6:23 PM, Goyal, Arpit  wrote:

> I can't compromise my business logic and there is hardly any data; but
> each time camel Route 2 starts Route 1, the previous route processing goes
> onto stack. I only have limited stack after that any operation can fail.
>
> To me below approach seems risky...I need to go async or remove the
> looping out of the route overall.
>
> Regards,
> Arpit.
>
> -Original Message-
> From: souciance [mailto:souciance.eqdam.ras...@gmail.com]
> Sent: Thursday, October 13, 2016 3:45 PM
> To: users@camel.apache.org
> Subject: Re: Looping in routes using Direct Component - Performance impact?
>
> I think you should first run your route setup with a few pages, 10s of
> pages, hundreds of pages and then thousands of pages and then do
> performance tests to see where what is eating memory and optimise from
> there.
>
> On Fri, Oct 14, 2016 at 12:31 AM, Goyal, Arpit [via Camel] <
> ml-node+s465427n5788744...@n5.nabble.com> wrote:
>
> > Hi,
> >
> > We currently are on 2.16.3 version and can't use the loop function (part
> > of 2.17). So we have the following routes based on which we create sort
> of
> > loop with switch case. Now we are worried about the performance (when we
> > see stacktrace of camel processing)
> >
> > Route 1:  from("direct:s1).to("read one page of data").process("process
> > one page").to("direct:s2");
> >
> > Route 2:  from("direct:s2").toD("go to external source").when("are more
> > pages left").to("direct:s1").otherwise().process("end processing");
> >
> > Now if there are thousands of pages, it is possible that this loop
> creates
> > lot of objects in memory & can create performance issue? Is there a way
> for
> > Camel to be told, before going to route 1 again, forget all the past? Is
> > disabling HISTORY would solve that?
> >
> > Regards,
> > Arpit.
> >
> >
> > --
> > If you reply to this email, your message will be added to the discussion
> > below:
> > http://camel.465427.n5.nabble.com/Looping-in-routes-using-
> > Direct-Component-Performance-impact-tp5788744

Re: Looping in routes using Direct Component - Performance impact?

2016-10-14 Thread souciance
Also, use seda for async processing and you can shutoff some camel stuff
like jmx, original message etc for increased performance. But for
performance you need to do good tests and make a change and repeat those
tests and measure.

On Fri, Oct 14, 2016 at 5:54 PM, Brad Johnson [via Camel] <
ml-node+s465427n578881...@n5.nabble.com> wrote:

> Have you looked at splitter/tokenizer/streaming for this instead of having
> route 1 call route 2 which calls route 1?  Interesting route setup as I've
> never used routes in a recursive fashion like that. When using direct the
> return doesn't happen until the end of the last route in the chain.  In
> this case it appears that you are continually delaying the return from the
> route via this iterative approach.  I'd have to check that via testing to
> see what's really happening in that case but I've never done it like that
> and would assume it would eventually run out of memory for large amounts
> of
> data.  As far as I know you can't just erase the history though you could
> set the body to null or empty string.  But I wouldn't do that.
>
> Just unmarshal your data and run it through the splitter in a streaming
> fashion.  If you don't need to process these in serial order you could
> then
> drop them on a SEDA queue with multiple consumer threads. You can then
> also
> set the queue size to limit how many documents are coming through at a
> time.
>
> Also, unless you have a compelling reason don't use Processors as they
> couple you to the framework. Just use a POJO and let Camel use reflection
> to select the correct method for processing or use annotations.  As a
> general rule of thumb I use, if you don't know exactly why you need to use
> a Processor you don't need to use it.
>
>
> On Thu, Oct 13, 2016 at 6:23 PM, Goyal, Arpit <[hidden email]
> > wrote:
>
> > I can't compromise my business logic and there is hardly any data; but
> > each time camel Route 2 starts Route 1, the previous route processing
> goes
> > onto stack. I only have limited stack after that any operation can fail.
> >
> > To me below approach seems risky...I need to go async or remove the
> > looping out of the route overall.
> >
> > Regards,
> > Arpit.
> >
> > -Original Message-
> > From: souciance [mailto:[hidden email]
> ]
> > Sent: Thursday, October 13, 2016 3:45 PM
> > To: [hidden email]
> 
> > Subject: Re: Looping in routes using Direct Component - Performance
> impact?
> >
> > I think you should first run your route setup with a few pages, 10s of
> > pages, hundreds of pages and then thousands of pages and then do
> > performance tests to see where what is eating memory and optimise from
> > there.
> >
> > On Fri, Oct 14, 2016 at 12:31 AM, Goyal, Arpit [via Camel] <
> > [hidden email] >
> wrote:
> >
> > > Hi,
> > >
> > > We currently are on 2.16.3 version and can't use the loop function
> (part
> > > of 2.17). So we have the following routes based on which we create
> sort
> > of
> > > loop with switch case. Now we are worried about the performance (when
> we
> > > see stacktrace of camel processing)
> > >
> > > Route 1:  from("direct:s1).to("read one page of
> data").process("process
> > > one page").to("direct:s2");
> > >
> > > Route 2:  from("direct:s2").toD("go to external source").when("are
> more
> > > pages left").to("direct:s1").otherwise().process("end processing");
> > >
> > > Now if there are thousands of pages, it is possible that this loop
> > creates
> > > lot of objects in memory & can create performance issue? Is there a
> way
> > for
> > > Camel to be told, before going to route 1 again, forget all the past?
> Is
> > > disabling HISTORY would solve that?
> > >
> > > Regards,
> > > Arpit.
> > >
> > >
> > > --
> > > If you reply to this email, your message will be added to the
> discussion
> > > below:
> > > http://camel.465427.n5.nabble.com/Looping-in-routes-using-
> > > Direct-Component-Performance-impact-tp5788744.html
> > > To start a new topic under Camel - Users, email
> > > [hidden email] 
> > > To unsubscribe from Camel - Users, click here
> > >  > unsubscribe_by_code&node=465428&code=c291Y2lhbmNlLmVxZGFtLnJhc2h0aU
> > BnbWFpbC5jb218NDY1NDI4fDE1MzI5MTE2NTY=>
> > > .
> > > NAML
> > >  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>
> > >
> >
> 

Re: Camel Spring Unit Testing with Mocks

2016-10-14 Thread catequil
Ok, so it appears that I understand and have a working copy.  There are
however a few remaining questions.  If you feel they are no longer relevant
in this thread let me know and I will create a new thread.

In the code below I expected it to grab the "myRouteMiddle" route and find
the endpoint(direct:end) intercept it and mock the direct:end as
mock:direct:end.

In the assertions I expected it to to have a body of "peace world!", but the
test passed with a body of "hello world!".

Am I misunderstanding how the intercepts and/or getRouteDefinition work?

On a second issue I intercepted "log:input" and the test failed saying there
were 3 messages.  I expected it to only have one based on the following
criteria:  
1. the "skipSendToOriginalEndpoint" should have stopped the last "log:input"
from being activated.
2. the getRouteDefinition was set to get "myMiddleRoute" which in my mind
should have gotten just the middle route and not the start route making the
total messages just 1.

Do you know why this works this way?  Is this a bug?  Or am I miss
understanding how it works?

Thanks





--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-Spring-Unit-Testing-with-Mocks-tp5788635p5788814.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: CxfEndpoint soap client usernametoken authentication

2016-10-14 Thread catequil
In step 1 you set 4 props.  Where would these props get set in the DSL?  or
can I somehow set them in the camel-config.xml as part of the cxfendpoint
element?  This part is a little vague to me.  I hope you can help?
Thanks!



--
View this message in context: 
http://camel.465427.n5.nabble.com/CxfEndpoint-soap-client-usernametoken-authentication-tp5787910p5788813.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Need help in processing comma seperated text file

2016-10-14 Thread Ranx
You can use Bindy though I've had better luck with the mapping in Beanio. 
Start with that first and then look at using a splitter/tokenizer to process
your files or write them out in the new format you require.

Just create a mapping file and a sample with a few records in it and run a
unit test to write the results out.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Need-help-in-processing-comma-seperated-text-file-tp5787930p5788812.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Looping in routes using Direct Component - Performance impact?

2016-10-14 Thread Brad Johnson
Have you looked at splitter/tokenizer/streaming for this instead of having
route 1 call route 2 which calls route 1?  Interesting route setup as I've
never used routes in a recursive fashion like that. When using direct the
return doesn't happen until the end of the last route in the chain.  In
this case it appears that you are continually delaying the return from the
route via this iterative approach.  I'd have to check that via testing to
see what's really happening in that case but I've never done it like that
and would assume it would eventually run out of memory for large amounts of
data.  As far as I know you can't just erase the history though you could
set the body to null or empty string.  But I wouldn't do that.

Just unmarshal your data and run it through the splitter in a streaming
fashion.  If you don't need to process these in serial order you could then
drop them on a SEDA queue with multiple consumer threads. You can then also
set the queue size to limit how many documents are coming through at a time.

Also, unless you have a compelling reason don't use Processors as they
couple you to the framework. Just use a POJO and let Camel use reflection
to select the correct method for processing or use annotations.  As a
general rule of thumb I use, if you don't know exactly why you need to use
a Processor you don't need to use it.


On Thu, Oct 13, 2016 at 6:23 PM, Goyal, Arpit  wrote:

> I can't compromise my business logic and there is hardly any data; but
> each time camel Route 2 starts Route 1, the previous route processing goes
> onto stack. I only have limited stack after that any operation can fail.
>
> To me below approach seems risky...I need to go async or remove the
> looping out of the route overall.
>
> Regards,
> Arpit.
>
> -Original Message-
> From: souciance [mailto:souciance.eqdam.ras...@gmail.com]
> Sent: Thursday, October 13, 2016 3:45 PM
> To: users@camel.apache.org
> Subject: Re: Looping in routes using Direct Component - Performance impact?
>
> I think you should first run your route setup with a few pages, 10s of
> pages, hundreds of pages and then thousands of pages and then do
> performance tests to see where what is eating memory and optimise from
> there.
>
> On Fri, Oct 14, 2016 at 12:31 AM, Goyal, Arpit [via Camel] <
> ml-node+s465427n5788744...@n5.nabble.com> wrote:
>
> > Hi,
> >
> > We currently are on 2.16.3 version and can't use the loop function (part
> > of 2.17). So we have the following routes based on which we create sort
> of
> > loop with switch case. Now we are worried about the performance (when we
> > see stacktrace of camel processing)
> >
> > Route 1:  from("direct:s1).to("read one page of data").process("process
> > one page").to("direct:s2");
> >
> > Route 2:  from("direct:s2").toD("go to external source").when("are more
> > pages left").to("direct:s1").otherwise().process("end processing");
> >
> > Now if there are thousands of pages, it is possible that this loop
> creates
> > lot of objects in memory & can create performance issue? Is there a way
> for
> > Camel to be told, before going to route 1 again, forget all the past? Is
> > disabling HISTORY would solve that?
> >
> > Regards,
> > Arpit.
> >
> >
> > --
> > If you reply to this email, your message will be added to the discussion
> > below:
> > http://camel.465427.n5.nabble.com/Looping-in-routes-using-
> > Direct-Component-Performance-impact-tp5788744.html
> > To start a new topic under Camel - Users, email
> > ml-node+s465427n465428...@n5.nabble.com
> > To unsubscribe from Camel - Users, click here
> >  unsubscribe_by_code&node=465428&code=c291Y2lhbmNlLmVxZGFtLnJhc2h0aU
> BnbWFpbC5jb218NDY1NDI4fDE1MzI5MTE2NTY=>
> > .
> > NAML
> >  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/Looping-in-routes-using-Direct-Component-Performance-
> impact-tp5788744p5788745.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


No HTTP response when using onException with BeanValidationException

2016-10-14 Thread Remco Schoen
Hi,

I’m trying to use the REST DSL and do validation on the incoming object with 
the Bean Validation Component.

I have configured my Spring XML like this:


  
org.apache.camel.component.bean.validator.BeanValidationException
  
true
  
  
422
  
  
Validation error.\n\Message:\n${exception.message}
  


But when I use the Swagger UI to send a message to my endpoint, I get no body 
or HTTP response code. For other exceptions this approach works.

Should this work with this exception?

I’m using version 2.17.3

Kind regards,

Remco Schoen

RE: Rest DSL with restlet Component, unable to access API when hosted on remote server

2016-10-14 Thread Steve Huston
I would start by chasing this as a firewall/routing problem with your network 
infrastructure people.

> -Original Message-
> From: ganga_camel [mailto:ganga...@gmail.com]
> Sent: Friday, October 14, 2016 9:37 AM
> To: users@camel.apache.org
> Subject: RE: Rest DSL with restlet Component, unable to access API when
> hosted on remote server
> 
> This is the error message that I get
> 
> Could not get any response
> There was an error connecting to
> http://:8081/bnt?9780226519791,9780415762564.
> 
> Why this might have happened:
> The server couldn't send a response:
> Ensure that the backend is working properly SSL connections are being
> blocked:
> Fix this by importing SSL certificates in Chrome Cookies not being sent:
> Use the Postman Interceptor extension
> Request timeout:
> Change request timeout in Settings > General
> 
> Thanks,
> Ganga
> 
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/Rest-DSL-
> with-restlet-Component-unable-to-access-API-when-hosted-on-remote-
> server-tp5788789p5788794.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


RE: Rest DSL with restlet Component, unable to access API when hosted on remote server

2016-10-14 Thread ganga_camel
This is the error message that I get

Could not get any response
There was an error connecting to
http://:8081/bnt?9780226519791,9780415762564.

Why this might have happened:
The server couldn't send a response:
Ensure that the backend is working properly
SSL connections are being blocked:
Fix this by importing SSL certificates in Chrome
Cookies not being sent:
Use the Postman Interceptor extension
Request timeout:
Change request timeout in Settings > General

Thanks,
Ganga



--
View this message in context: 
http://camel.465427.n5.nabble.com/Rest-DSL-with-restlet-Component-unable-to-access-API-when-hosted-on-remote-server-tp5788789p5788794.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Rest DSL with restlet Component, unable to access API when hosted on remote server

2016-10-14 Thread Jonas Koperdraat
The first thing that comes to my mind is CORS (cross origin resource
sharing) headers, but I'm not sure whether the restlet component adheres to
those..

On Fri, Oct 14, 2016, 15:21 Steve Huston  wrote:

> Sounds like a firewall (or similar) configuration issue.
>
> If not, please try posting more about what's not working - error messages,
> etc.
>
> -Steve
>
> > -Original Message-
> > From: ganga_camel [mailto:ganga...@gmail.com]
> > Sent: Friday, October 14, 2016 9:00 AM
> > To: users@camel.apache.org
> > Subject: Rest DSL with restlet Component, unable to access API when
> hosted
> > on remote server
> >
> > Hi,I have a camel route with Rest DSL using the restlet component,
> > configuration as listed
> > belowrestConfiguration().component("restlet").host("{{hostname}}").port("
> > {{port}}")
> > .dataFormatProperty("prettyPrint", "true");
> > rest("/books").consumes(MediaType.ALL.toString())
> > .produces(MediaType.ALL.toString())
> > .post().to("direct:ProcessData");When I run the camel service on my local
> > machine with port as anything other than 8080(eg: 9091, 8081 etc), I
> am
> > able successfully post to the Rest API.However, when I deploy the rest
> API
> > code on the remote server to listen on port 9091 or 8081 etc... (anything
> > other than port 8080), I am unable to post to the rest API. But am able
> to
> > successfully post to rest API deployed on remote server when the port is
> set
> > to 8080.This behavior is observed only when the rest API is deployed on
> > remote host but works fine with any port number when rest API is running
> > on the local machine.Any suggestions would be highly
> > appreciated.Thanks,Ganga
> >
> >
> >
> > --
> > View this message in context:
> http://camel.465427.n5.nabble.com/Rest-DSL-
> > with-restlet-Component-unable-to-access-API-when-hosted-on-remote-
> > server-tp5788789.html
> > Sent from the Camel - Users mailing list archive at Nabble.com.
>


RE: Rest DSL with restlet Component, unable to access API when hosted on remote server

2016-10-14 Thread Steve Huston
Sounds like a firewall (or similar) configuration issue.

If not, please try posting more about what's not working - error messages, etc.

-Steve

> -Original Message-
> From: ganga_camel [mailto:ganga...@gmail.com]
> Sent: Friday, October 14, 2016 9:00 AM
> To: users@camel.apache.org
> Subject: Rest DSL with restlet Component, unable to access API when hosted
> on remote server
> 
> Hi,I have a camel route with Rest DSL using the restlet component,
> configuration as listed
> belowrestConfiguration().component("restlet").host("{{hostname}}").port("
> {{port}}")
> .dataFormatProperty("prettyPrint", "true");
> rest("/books").consumes(MediaType.ALL.toString())
> .produces(MediaType.ALL.toString())
> .post().to("direct:ProcessData");When I run the camel service on my local
> machine with port as anything other than 8080(eg: 9091, 8081 etc), I am
> able successfully post to the Rest API.However, when I deploy the rest API
> code on the remote server to listen on port 9091 or 8081 etc... (anything
> other than port 8080), I am unable to post to the rest API. But am able to
> successfully post to rest API deployed on remote server when the port is set
> to 8080.This behavior is observed only when the rest API is deployed on
> remote host but works fine with any port number when rest API is running
> on the local machine.Any suggestions would be highly
> appreciated.Thanks,Ganga
> 
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/Rest-DSL-
> with-restlet-Component-unable-to-access-API-when-hosted-on-remote-
> server-tp5788789.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


Rest DSL with restlet Component, unable to access API when hosted on remote server

2016-10-14 Thread ganga_camel
Hi,I have a camel route with Rest DSL using the restlet component,
configuration as listed
belowrestConfiguration().component("restlet").host("{{hostname}}").port("{{port}}")
   
.dataFormatProperty("prettyPrint", "true");   
rest("/books").consumes(MediaType.ALL.toString())   
.produces(MediaType.ALL.toString())   
.post().to("direct:ProcessData");When I run the camel service on my local
machine with port as anything other than 8080(eg: 9091, 8081 etc), I am
able successfully post to the Rest API.However, when I deploy the rest API
code on the remote server to listen on port 9091 or 8081 etc... (anything
other than port 8080), I am unable to post to the rest API. But am able to
successfully post to rest API deployed on remote server when the port is set
to 8080.This behavior is observed only when the rest API is deployed on
remote host but works fine with any port number when rest API is running on
the local machine.Any suggestions would be highly appreciated.Thanks,Ganga 



--
View this message in context: 
http://camel.465427.n5.nabble.com/Rest-DSL-with-restlet-Component-unable-to-access-API-when-hosted-on-remote-server-tp5788789.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel swagger doesn't support array of objects as input type

2016-10-14 Thread Sw1m1k
???



--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-swagger-doesn-t-support-array-of-objects-as-input-type-tp5788557p5788786.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Need help in processing comma seperated text file

2016-10-14 Thread raghavender.anth...@gmail.com
Can someone guide me on this?

Thank you.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Need-help-in-processing-comma-seperated-text-file-tp5787930p5788783.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Send message to temporary queue

2016-10-14 Thread axdz
Hi all,

Follow this link 
http://activemq.apache.org/how-should-i-implement-request-response-with-jms.html

  

I did it but, it can not send message to temporary queue (which is got from
replyTo field).

 //Set the correlation ID from the received message to be the correlation id
of the response message
//this lets the client identify which message this is a response
to if it has more than
//one outstanding message to the server
response.setJMSCorrelationID(message.getJMSCorrelationID());
 
//Send the response to the Destination specified by the
JMSReplyTo field of the received message,
//this is presumably a temporary queue created by the client
this.replyProducer.send(message.getJMSReplyTo(), response);

Can you explain to me about temporary queue and what should i do in this
problem.
Thanks,





--
View this message in context: 
http://camel.465427.n5.nabble.com/Send-message-to-temporary-queue-tp5788779.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: CamelCdiRunner loads all routes in each test case (sometimes)

2016-10-14 Thread Dennis Bohnstedt Hansen
Hi

Thanks for you quick answer!

>> 3) If Weld and Camel versions are the same - where do i look for the
error??!?
> Not sure I understand the question here :(

This refered to the fact, that i had two different behaviours in the two
projects - and i could'nt figure out which was the correct behaviour and
WHY they were different. You answer gave me a clue though. It turned out,
that one of my projects was a WAR project and the other was a JAR project,
and that beans.xml was not loaded on the WAR file (since it was located
/webapp/WEB-INF/beans.xml and therefor not picked up by the classloader).

This gave me a "solution" to my problem, even though it's not perfect.
Unfortunately you can't override src/main/resources/beans.xml with a
src/test/resources/beans.xml in Weld (
https://issues.jboss.org/browse/WELD-2054), but i was able to exclude the
package containing my RouteBuildes by adding an exclution to my beans.xml,
and having a "marker class" (ExcludeRouteBuildersFromTest.java) in
src/test/java.










> That being said, we may want to improve CamelCdiRunner to meet your need,
provided that it does not hinder the original intent, that is simplicity
and convention over configuration.

I think that would be a very good idea. The problem with the current
default, is that if all routes a loaded, you have to handle all endpoints
in every class. "Unfortunately" you are helped by the fact that the
folowing code, actually mocks and skips ALL endpoints in the CamelContext,
not just endpoints in the current route being adviced, but i'm thinkin that
thats a bug that will be fixed at some point:

context.getRouteDefinition("MyRouteId").adviceWith(context, new
AdviceWithRouteBuilder() {
public void configure() throws Exception {
mockEndpointsAndSkip("*");
}
});

But you would also have to replace "from endpoints" of all routes in every
test, if they communicate with resources that are not available in you unit
tests - and you can't advice with the same replaceFromWith(...), in
different classes, since advices with @Observable conflict when all routes
are loaded.

... But thanks again!

/Dennis


Re: Camel JSON

2016-10-14 Thread Tomohisa Igarashi

Hi,

What actually is returning status 500? Any external REST service? Can you see 
that REST service log, specifically the actual payload you sent? And how does 
your camel route look like?

Thanks,
Tomo

On 10/14/2016 02:06 PM, dpravin wrote:

Hello All,

The requirement is extract data from a Oracle database and one of the field
is a Clob field (JSON format). I have set this field as Camel message body
and invoking a REST web service. However I get an error with statusCode:
500. Appreciate if you could help me resolve this issue.

Thanks,
P



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



Re: file component polling files

2016-10-14 Thread redpower1989
I tried maxMessagesPerPoll = 1 and delay 30 secs and it wasn't picking 1 file
every 30 secs and i am wondering if i am setting something wrong on the
consumer. 

By the way i found a way to speed up the file processing and it is the use
of threads. Be careful that you need to find a balance for the poolsize
value.
http://camel.apache.org/async.html



--
View this message in context: 
http://camel.465427.n5.nabble.com/file-component-polling-files-tp5788570p5788775.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: netty4 producer and default codec

2016-10-14 Thread souciance
I have used the StringEncoder previously so perhaps it will be easier to
use ByteArrayEncoder/Decoder..See example here:
http://stackoverflow.com/questions/22794326/not-able-to-send-byte-to-server-with-netty

On Fri, Oct 14, 2016 at 1:51 AM, Steve973 [via Camel] <
ml-node+s465427n5788748...@n5.nabble.com> wrote:

> We tried just taking our byte array and wrapping it in a netty ByteBuf.  I
> read that it's one of the two ways that you can do it.  Either that or use
> a ByteArrayEncoder.  Thoughts?  And thanks for your suggestion, too!
>
> On Thu, Oct 13, 2016 at 5:41 PM, souciance <[hidden email]
> 
> > wrote:
>
> > You could create a test route which listens via netty4 tcp and see how
> it
> > behaves with the default codec. If it reads properly then it should ok.
> > Worst case, you may need to encode/decode it.
> >
> > On Thu, Oct 13, 2016 at 5:27 PM, Steve973 [via Camel] <
> > [hidden email] >
> wrote:
> >
> > > Hello.  If I am creating a byte array to send via a netty4 tcp
> endpoint,
> > > should I disable the default codec?  I want to ensure that the bytes
> are
> > > delivered simply as bytes, and not garbled by an encoding.
> > >
> > > Thanks,
> > > Steve
> > >
> > >
> > > --
> > > If you reply to this email, your message will be added to the
> discussion
> > > below:
> > > http://camel.465427.n5.nabble.com/netty4-producer-and-
> > > default-codec-tp5788736.html
> > > To start a new topic under Camel - Users, email
> > > [hidden email] 
> > > To unsubscribe from Camel - Users, click here
> > >  > unsubscribe_by_code&node=465428&code=c291Y2lhbmNlLmVxZGFtLnJhc2h0aU
> > BnbWFpbC5jb218NDY1NDI4fDE1MzI5MTE2NTY=>
> > > .
> > > NAML
> > >  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/netty4-producer-and-default-codec-tp5788736p5788741.html
> > Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
> --
> If you reply to this email, your message will be added to the discussion
> below:
> http://camel.465427.n5.nabble.com/netty4-producer-and-default-codec-
> tp5788736p5788748.html
> To start a new topic under Camel - Users, email
> ml-node+s465427n465428...@n5.nabble.com
> To unsubscribe from Camel - Users, click here
> 
> .
> NAML
> 
>




--
View this message in context: 
http://camel.465427.n5.nabble.com/netty4-producer-and-default-codec-tp5788736p5788772.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Apache Camel with Play Framework

2016-10-14 Thread vinodkar87
Can we use apache Camel in Play framework?



--
View this message in context: 
http://camel.465427.n5.nabble.com/Apache-Camel-with-Play-Framework-tp5788760.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Camel JSON

2016-10-14 Thread dpravin
Hello All,

The requirement is extract data from a Oracle database and one of the field
is a Clob field (JSON format). I have set this field as Camel message body
and invoking a REST web service. However I get an error with statusCode:
500. Appreciate if you could help me resolve this issue.

Thanks,
P



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


Timeout for http-conf:client take no effect

2016-10-14 Thread helenlok
Hi, I'm trying to edit the default timeout for my web service to wait for a
response where it is set with a Thread.sleep for 5000 ms. 

I set the timeout to be 1000 ms using http-conf:client and it suppose to be
timeout in 1000 ms seconds instead but nothing occurs. 

Can someone enlighten me as to what I am doing wrong? 

I had to edit out some of the names of my config file, but everything is
listed below. 

Thanks a lot. 

(Config file below) 



http://www.springframework.org/schema/beans";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:camel="http://camel.apache.org/schema/spring";
xmlns:cxf="http://camel.apache.org/schema/cxf";
xmlns:context="http://www.springframework.org/schema/context";
xmlns:http-conf="http://cxf.apache.org/transports/http/configuration";
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
   http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
   http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd
   http://camel.apache.org/schema/cxf
http://camel.apache.org/schema/cxf/camel-cxf.xsd
   http://cxf.apache.org/transports/http/configuration
http://cxf.apache.org/schemas/configuration/http-conf.xsd";>





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

http://someservice?dataFormat=PAYLOAD&wsdlURL=http://someservice?wsdl&";
id="endpointa" />

http://someservice1?dataFormat=PAYLOAD&wsdlURL=http://someservice1?wsdl&";
id="endpointb" />















--
View this message in context: 
http://camel.465427.n5.nabble.com/Timeout-for-http-conf-client-take-no-effect-tp5788752.html
Sent from the Camel - Users mailing list archive at Nabble.com.


http-conf:client not working

2016-10-14 Thread helenlok
Hi, I'm trying to edit the default timeout for my web service to wait for a
response where it is set with a Thread.sleep for 5000 ms. 

I set the timeout to be 1000 ms using http-conf:client and it suppose to be
timeout in 1000 ms seconds instead but nothing occurs. 

Can someone enlighten me as to what I am doing wrong? 

I had to edit out some of the names of my config file, but everything is
listed below. 

Thanks a lot. 

(Config file below) 

 

http://www.springframework.org/schema/beans";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:camel="http://camel.apache.org/schema/spring";
xmlns:cxf="http://camel.apache.org/schema/cxf";
xmlns:context="http://www.springframework.org/schema/context";
   
xmlns:http-conf="http://cxf.apache.org/transports/http/configuration";
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
   http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
   http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd
   http://camel.apache.org/schema/cxf
http://camel.apache.org/schema/cxf/camel-cxf.xsd
   http://cxf.apache.org/transports/http/configuration
http://cxf.apache.org/schemas/configuration/http-conf.xsd";>





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

http://someservice?dataFormat=PAYLOAD&wsdlURL=http://someservice?wsdl&";
id="endpointa" />

http://someservice1?dataFormat=PAYLOAD&wsdlURL=http://someservice1?wsdl&";
id="endpointb" />















--
View this message in context: 
http://camel.465427.n5.nabble.com/http-conf-client-not-working-tp5788755.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Timeout for http-conf:client doesn't seem to work

2016-10-14 Thread helenlok
Hi, I'm trying to edit the default timeout for my web service to wait for a
response where it is set with a Thread.sleep for 5000 ms. 

I set the timeout to be 1000 ms using http-conf:client and it suppose to be
timeout in 1000 ms seconds instead but nothing occurs. 

Can someone enlighten me as to what I am doing wrong? 

I had to edit out some of the names of my config file, but everything is
listed below. 

Thanks a lot. 

(Config file below) 

 

http://www.springframework.org/schema/beans";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:camel="http://camel.apache.org/schema/spring";
xmlns:cxf="http://camel.apache.org/schema/cxf";
xmlns:context="http://www.springframework.org/schema/context";
   
xmlns:http-conf="http://cxf.apache.org/transports/http/configuration";
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
   http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
   http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd
   http://camel.apache.org/schema/cxf
http://camel.apache.org/schema/cxf/camel-cxf.xsd
   http://cxf.apache.org/transports/http/configuration
http://cxf.apache.org/schemas/configuration/http-conf.xsd";>





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

http://someservice?dataFormat=PAYLOAD&wsdlURL=http://someservice?wsdl&";
id="endpointa" />

http://someservice1?dataFormat=PAYLOAD&wsdlURL=http://someservice1?wsdl&";
id="endpointb" />















--
View this message in context: 
http://camel.465427.n5.nabble.com/Timeout-for-http-conf-client-doesn-t-seem-to-work-tp5788753.html
Sent from the Camel - Users mailing list archive at Nabble.com.