Validation on build time of camel component fails when component has some getter/setters

2015-12-09 Thread Roman Vottner
Hi there,

we use Camel 2.16.0 and are currently developing a Camel component and on 
trying to build an artifact using „mvn clean install“ or „mvn clean package“ 
the build fails due to: Missing component documentation for the following 
options: … as the component class defines a getter and setter for a property 
with @UriEndpoint and other documentation enabled in Endpoint and Configuration 
classes. If the getter/setter is removed from the component class and the value 
assignment moved to a customized constructor the build succeeds. Putting a 
@UriParam (or similar) annotation on the component property does not solve the 
problem and specifying an @Uri… annotation on the getter/setter does not work 
either as they are restricted to fields or classes.

Is validation considered working as intended as components should not define 
getter/setter and therefore properties or is this a bug?

Re: Validation on build time of camel component fails when component has some getter/setters

2015-12-09 Thread Claus Ibsen
Add javadoc to the setter methods or both of them so you *actually*
document your component options what they are intended for.

On Wed, Dec 9, 2015 at 2:01 PM, Roman Vottner  wrote:
> Hi there,
>
> we use Camel 2.16.0 and are currently developing a Camel component and on 
> trying to build an artifact using „mvn clean install“ or „mvn clean package“ 
> the build fails due to: Missing component documentation for the following 
> options: … as the component class defines a getter and setter for a property 
> with @UriEndpoint and other documentation enabled in Endpoint and 
> Configuration classes. If the getter/setter is removed from the component 
> class and the value assignment moved to a customized constructor the build 
> succeeds. Putting a @UriParam (or similar) annotation on the component 
> property does not solve the problem and specifying an @Uri… annotation on the 
> getter/setter does not work either as they are restricted to fields or 
> classes.
>
> Is validation considered working as intended as components should not define 
> getter/setter and therefore properties or is this a bug?



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


Re: Having issues with Multicast to Aggregation ...

2015-12-09 Thread jtoepfer
So after digging into the documentation for the last 2 days. There is a
parameter called routeEmptyResultSet, and it's set to false.  This could be
the problem, but I'm not aware to set this?  Looking at the code doesn't
seem really obvious.  Some direction would be helpful if i'm on the right
track.



-
Josh Toepfer
--
View this message in context: 
http://camel.465427.n5.nabble.com/Having-issues-with-Multicast-to-Aggregation-tp5774688p5774860.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Dynamically created CamelContext not visible in fuse console

2015-12-09 Thread rwijngaa
Hi,

I got 2 camel contexts defined in xml and a bunch of others i created
dynamically with:
   CamelContext camelContext = new SpringCamelContext(applicationContext);

The point is, when doing "camel:context-list" in the JBoss Fuse 6.2 console,
is only get to see the 2 (fixed) ones. In hawtio i see them all!

How can i fix this?

Regards
Rino



--
View this message in context: 
http://camel.465427.n5.nabble.com/Dynamically-created-CamelContext-not-visible-in-fuse-console-tp5774855.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Using Stream Cache With Apache Camel

2015-12-09 Thread kikou1984
I m using stream caching with this example below.

I have three routes.

First, I used the split streaming with a token "\n", reading a file splitted
by line. 

 








Then I made a business process : 







public class ProcessBusiness {

 public String dealRecord(@Body String body){
 System.out.println(body);
 return body;
}

And Finally, 





${header.CamelFileName}.${header.CamelSplitIndex}  





   public class ProcessStreamCaching {

 public String usingStream(Exchange exchange){
 Object o = exchange.getIn().getBody(StreamCache.class);
 return  o.toString();
}

I wanted to get the whole file in this process (`ProcessStreamCaching`).

How can i correctly use the stream cache ? How can i get read the file again
from the beginning, that s why i want to use the stream cache.

The file before splitting contain :

X
Y
Z
A

C

SSQQQ
Z
Z

 I thought that the stream cache was able to put all line of the file in a
cache, and i can retrieve these lines.

 How can I see what is placed in the cache ?  

 I thought when i add  `streamCache="true"` at this route ``, each line of the splitter will be placed on the cache.
(or may be the whole file) 

 At the last process `ProcessStreamCaching`, if I wanted to reload the 
`inputStream` from the beginning , but at this process i can't because i
have already read the `inputStream`.

 I want to keep reading the file with streaming line per line, but at on
process  I need to read for exemple the first line , that s why i wanted to
use the stream cache , who allows me to browse the file from the beginning.
 
 May be I misunderstand the Stream Cache.




--
View this message in context: 
http://camel.465427.n5.nabble.com/Using-Stream-Cache-With-Apache-Camel-tp5774856.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Camel Aggregator: Using up the complete heap

2015-12-09 Thread ganga_camel
Hi, 

I have a camel route which will split the file based on the newline
charterer and writes the data into 3 different files based on some business
logic. 

The file is 135MB in size. While running the route, the observation is the
initial processing is pretty good however as the records get processed the
aggregator is filling up the heap constantly and at one point the heap is
full and the processing gets dead slow and comes to complete HOLD. 

The aggregator configuration is a below, is there a way we can ensure the
heap is released as and when the records are dumped into the seda block? 




true





-Ganga



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-Aggregator-Using-up-the-complete-heap-tp5774854.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Dynamically created CamelContext not visible in fuse console

2015-12-09 Thread Claus Ibsen
You need to create them as osgi camel context, and do a bunch of osgi
initialization to make that work. Its not so easy to do but see in
camel-core-osgi source code

On Wed, Dec 9, 2015 at 1:35 PM, rwijngaa  wrote:
> Hi,
>
> I got 2 camel contexts defined in xml and a bunch of others i created
> dynamically with:
>CamelContext camelContext = new SpringCamelContext(applicationContext);
>
> The point is, when doing "camel:context-list" in the JBoss Fuse 6.2 console,
> is only get to see the 2 (fixed) ones. In hawtio i see them all!
>
> How can i fix this?
>
> Regards
> Rino
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Dynamically-created-CamelContext-not-visible-in-fuse-console-tp5774855.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: Create multiple SQLComponent

2015-12-09 Thread Ramiro Pugh
Hi Alexis, I'm not sure if you can have multiple SQL Components. Camel has
a registry of components (what I've understood) and when I'd tried to use
two components in the same context I had only just one, this is (I think)
for the way that they registry and why is so easy to auto discovery a
component.

May be your solution can exist in different applications and send the
exchange with direct-vm (because your apps will be in different
applications) instead of using everything in the same app.

Hope anyone with more knowledge than me could clarify this for you.

Cheers!

2015-10-26 6:33 GMT-03:00 alexis.jacquemart :

> Hi !
>
> I'm trying to create a WAR application that create routes between multiple
> sources and one destination. The sources can be SQL Database, MongoDB, REST
> Service, etc and parameters of these connections are stored in a external
> database.
>
> Until now, I was using Spring to initialize the SQLComponent or MongoClient
> bean but it wasn't dynamic :
>
> 
> 
> 
>
>  class="org.apache.commons.dbcp.BasicDataSource"
> factory-bean="sqlConnector"
> factory-method="setupDataSource">
> 
>
> 
> 
> 
>
> I need to do it in the Java code. Moreover, I have a list of datasources
> and
> I have to create as many SQLComponent as my number of SQL datasources (the
> same for MongoDB). *The problem is, I don't have any idea where I can
> create
> them..*
>
> I've created an interface ConnectorEndpoint which regroups the parameters
> needed by each type of Camel Component.
>
> The process looks like that : DAO -> getDatasources() -> create the
> ConnectorEndPoint -> constructor args of the RouteBuilder -> create the
> route
>
> And my code looks like that :
>
> *In my RouteBuilder constructor : *
>
>  for (Datasource datasource : listDatasources){
> switch (datasource.getType()) {
> case "oracle" :
> srcs.add(new ConnectorSQL(datasource));
> // I was thinking about create them here but I
> have to give
> them dynamic name
> // to match with the name of the component
> *to("sql" + id +
> "://" + query)* in the route, no ?
> break;
> case "elastic" :
> srcs.add(new ConnectorElasticSearch(datasource));
> break;
> case "mongo" :
> srcs.add(new ConnectorMongoDB(datasource));
>  // I was thinking about create them here
> break;
> case "rest" :
> srcs.add(new ConnectorREST(datasource));
> break;
> }
> }
>
> *The configure method :*
>
>  public void configure() {
> for (ConnectorEndPoint src : this.srcs) {
>  if (src instanceof ConnectorSQL){
> from("direct:" + src.getId()).*to("sql" + id + "://" +
> query)*
> .to(dest.getRouteTo());
>  } else if (src instanceof ConnectorMongoDB){
> from("direct:" +
> src.getId()).to(mongodb:mongoDriver?database=...)
> .to(dest.getRouteTo());
>  } else if (src instanceof ConnectorREST){
> ...
> }
>}
>
> In fact, I don't understand where the SQLComponents must be in the
> application for the Camel Context can be able to find them. I have thought
> about a Registry but how can I give it to the Camel Context and where do I
> have to create it ?
>
> I know that's a long message but I'll thank everyone that would try to help
> me ;)
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Create-multiple-SQLComponent-tp5773059.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Ramiro Pugh


Re: Camel Aggregator: Using up the complete heap

2015-12-09 Thread contactreji
Yea . I have noticed that camel aggregators slow down the throughput in case
of heavy volume files like GB sizes. 

Is there any alternative component in camel which can be used in place of
aggregator. 

I am talking about use cases which takes in 10 GB files which are new line
tokenized and after processing we try to put them together for output file
dump

Reji



-
Reji Mathews
Sr. Developer - Middleware Integration / SOA ( Open Source - Apache Camel & 
Jboss Fuse ESB | Mule ESB )
LinkedIn - http://in.linkedin.com/pub/reji-mathews/31/9a2/40a
Twitter - reji_mathews
--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-Aggregator-Using-up-the-complete-heap-tp5774854p5774861.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Dynamically created CamelContext not visible in fuse console

2015-12-09 Thread rwijngaa
ok, tried that. 

CamelContext camelContext = new
OsgiSpringCamelContext(getApplicationContext(),
Activator.getBundleContext());
 ((OsgiSpringCamelContext)camelContext).setName(contextId);


The OsgiSpringCamelContext constructor is calling
OsgiCamelContextHelper.osgiUpdate(this, bundleContext)) and this seems to do
a lot of OSGi initialisation, but still no luck !
note: Activator is copied from org.apache.camel.osgi.Activator and present
in my bundle's manifest as Bundle-Activator.

Any pointers would be apprecciated
Regards
Rino



--
View this message in context: 
http://camel.465427.n5.nabble.com/Dynamically-created-CamelContext-not-visible-in-fuse-console-tp5774855p5774864.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Having issues with Multicast to Aggregation ...

2015-12-09 Thread Claus Ibsen
You can check unit tests they often test the various options.

On Wed, Dec 9, 2015 at 2:17 PM, jtoepfer  wrote:
> So after digging into the documentation for the last 2 days. There is a
> parameter called routeEmptyResultSet, and it's set to false.  This could be
> the problem, but I'm not aware to set this?  Looking at the code doesn't
> seem really obvious.  Some direction would be helpful if i'm on the right
> track.
>
>
>
> -
> Josh Toepfer
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Having-issues-with-Multicast-to-Aggregation-tp5774688p5774860.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: Dynamically created CamelContext not visible in fuse console

2015-12-09 Thread Claus Ibsen
Yeah that's the guy that triggers some osgi code that enlist the camel
context in the osgi service registry at that bundle, which is what the
karaf camel command uses.

See also how camel-scr does some stuff as it does also manually do
some osgi initialization
https://github.com/apache/camel/blob/master/components/camel-scr/src/main/java/org/apache/camel/scr/AbstractCamelRunner.java

On Wed, Dec 9, 2015 at 4:49 PM, Antonin Stefanutti
 wrote:
> You need the following piece of code to be executed so that your Camel 
> contexts get published as OSGi services:
>
> context.getManagementStrategy().addEventNotifier(new 
> OsgiCamelContextPublisher(BundleContextUtils.getBundleContext(getClass(;
>
> Then your Camel contexts will be visible from Camel Karaf commands.
>
> Antonin
>
>> On 09 Dec 2015, at 15:52, rwijngaa  wrote:
>>
>> ok, tried that.
>>
>>CamelContext camelContext = new
>> OsgiSpringCamelContext(getApplicationContext(),
>> Activator.getBundleContext());
>> ((OsgiSpringCamelContext)camelContext).setName(contextId);
>>
>>
>> The OsgiSpringCamelContext constructor is calling
>> OsgiCamelContextHelper.osgiUpdate(this, bundleContext)) and this seems to do
>> a lot of OSGi initialisation, but still no luck !
>> note: Activator is copied from org.apache.camel.osgi.Activator and present
>> in my bundle's manifest as Bundle-Activator.
>>
>> Any pointers would be apprecciated
>> Regards
>> Rino
>>
>>
>>
>> --
>> View this message in context: 
>> http://camel.465427.n5.nabble.com/Dynamically-created-CamelContext-not-visible-in-fuse-console-tp5774855p5774864.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: Dynamically created CamelContext not visible in fuse console

2015-12-09 Thread Antonin Stefanutti
You need the following piece of code to be executed so that your Camel contexts 
get published as OSGi services:

context.getManagementStrategy().addEventNotifier(new 
OsgiCamelContextPublisher(BundleContextUtils.getBundleContext(getClass(;

Then your Camel contexts will be visible from Camel Karaf commands.

Antonin

> On 09 Dec 2015, at 15:52, rwijngaa  wrote:
> 
> ok, tried that. 
> 
>CamelContext camelContext = new
> OsgiSpringCamelContext(getApplicationContext(),
> Activator.getBundleContext());
> ((OsgiSpringCamelContext)camelContext).setName(contextId);
> 
> 
> The OsgiSpringCamelContext constructor is calling
> OsgiCamelContextHelper.osgiUpdate(this, bundleContext)) and this seems to do
> a lot of OSGi initialisation, but still no luck !
> note: Activator is copied from org.apache.camel.osgi.Activator and present
> in my bundle's manifest as Bundle-Activator.
> 
> Any pointers would be apprecciated
> Regards
> Rino
> 
> 
> 
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Dynamically-created-CamelContext-not-visible-in-fuse-console-tp5774855p5774864.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



Re: Using Stream Cache With Apache Camel

2015-12-09 Thread kikou1984
When i m trying to get the cache it returns null

StreamCache cache = exchange.getIn().getBody(StreamCache.class);

Do you have an idea how i can retrieve the StreamCache ? 

Thxs



--
View this message in context: 
http://camel.465427.n5.nabble.com/Using-Stream-Cache-With-Apache-Camel-tp5774856p5774868.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Setting timeout in Springboot

2015-12-09 Thread raffi
Figured it out, 

  bean id="shutdown" class="org.apache.camel.impl.DefaultShutdownStrategy"

 



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


Shutdown hook in FatJarRouter - Springboot

2015-12-09 Thread raffi

I'm using Camel 2.16.0 with springboot 1.2.6-RELEASE, the app is packaged
and executed using FatJarRouter.

My routes run properly, but I'm having an issue with shutdown. I can
shutdown Camel using setShutdownNowOnTimeout() via JMX, that's not a
problem. But when shutting down Springboot using http://.../shutdown, it
gets stuck closing 'metricsExecutor' pool, and the JVM does not exit. I
don't believe this problem is related to Camel, but to address it, I want to
test shutting down this thread pool manually, so I need a way to hook into
the springboot's shutdown process.

##last line in log file where JVM hangs
2015-12-09 13:27:56,607 INFO  ThreadPoolTaskExecutor - Shutting down
ExecutorService 'metricsExecutor'

This is how we launch Camel in Springboot using FatJarRouter; can I hook
into the shutdown process to close 'metricsExecutor' bean manually?

@ImportResource(value={"classpath:META-INF/spring/camel-context.xml"})
@SpringBootApplication
public class MySpringBootRouter extends FatJarRouter {

   public static void main(String[] options){
  MySpringBootRouter router = new MySpringBootRouter();
   }
}

Raffi




--
View this message in context: 
http://camel.465427.n5.nabble.com/Shutdown-hook-in-FatJarRouter-Springboot-tp5774880.html
Sent from the Camel - Users mailing list archive at Nabble.com.


How to configure correctly Error Handler for redelivery

2015-12-09 Thread Michele
Hi everyone,

I configure my routing and redelivery policy as follow but it doesn't work:








application/json


POST

 











 

























Redelivery policy doesn't work properly. Either route should follow the same
error handler (CRM_LoginRoute dependes on ProcessMessageData_Route).

Any idea or suggestions to resolve redeliveries on ConnectionException?

Thanks in advance

Kind regards

Michele



--
View this message in context: 
http://camel.465427.n5.nabble.com/How-to-configure-correctly-Error-Handler-for-redelivery-tp5774877.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Shutdown hook in FatJarRouter - Springboot

2015-12-09 Thread raffi
After some more digging, here's what I found.

Invoking stop() on camel context shuts down all routes gracefully as per the
log, but two problems I'm seeing after routes are shut down is (I believe)
the cause for JVM not shutting down:

#1) ActiveMQ connection remains open

#2) AbstractInactivityMonitor is constantly checking every 10s

We use Springboot config for ActiveMQ instead of the typical  config:

#application.properties
spring.activemq.broker-url=tcp://amq1:61107
spring.activemq.user=amq
spring.activemq.password=xxx1
spring.activemq.pooled=true


And our camel route config, just a short sample, but key point: no JMS
connection pool info defined here:

  

  


I'm not sure why the activemq connection is not closing, is there anything
wrong with this config that causing the inability to not shut down cleanly?
 



--
View this message in context: 
http://camel.465427.n5.nabble.com/Shutdown-hook-in-FatJarRouter-Springboot-tp5774880p5774884.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Multi-threaded UDP server with netty4?

2015-12-09 Thread mkitchin
Hi there,

We have a moderately unusual use-case we're having issues implementing.

- Java 8, Camel 2.15.2, Felix w/Camel DSL running in Docker
- UDP server based on camel-netty4 component
- Receiving small (<100 bytes), stateless messages
- Sending small, per-message responses

The problem is performance-related: Due to netty4's standard threading
model, there's one worker thread per channel to maintain order (UDP
listening port, in this case; somewhat known issue), despite settings such
as workerCount. In testing, this has proven too slow with given hardware, so
we'd like to parallelize processing since request/response order isn't
critical.

To attempt this, we changed our DSL to attempt the asyc request/reply
pattern, like so (note "sync=true", as we send responses):

from("?sync=true")
.process()

...to:


from("?sync=true")
   .threads(10)
.process()

With the threads() call in place, however, responses don't appear to be
getting back to the clients.

We've debugged the async callback through the Consumer and at least that's
happening but we're not sure what's going on beyond there. The destination
address (an ephemeral port on the remote client) seems to make it through in
metadata. Sniffing around on Wireshark might help, but things are
complicated in that department (Felix running in Docker, Docker running in a
Ubuntu VM, ...).

Should this work, either with this thread pool or something like SEDA
endpoints in the middle? By going asynchronous, netty4 is no longer getting
direct responses, so does sync=true or disconnectOnNoReply have any bearing?
Any better ideas how to accomplish this?

Thanks for your time, in advance.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Multi-threaded-UDP-server-with-netty4-tp5774901.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Setting timeout in Springboot

2015-12-09 Thread raffi.onjava
Hi,

In Springboot, what is the config parameter name for setting timeout in 
DefaultShutdownStrategy from application.properties?

#application.properties
camel.timeout = 10




Re: Using Stream Cache With Apache Camel

2015-12-09 Thread Claus Ibsen
The splitter will split the file and each of those splitted sub
messages do not have the entire content, but only that chunk of the
message. If you want to read the entire file again, then dont use the
splitter, but just do a from file -> to process, and you can access
the file using java.io.File / InputStream etc.



On Wed, Dec 9, 2015 at 1:41 PM, kikou1984  wrote:
> I m using stream caching with this example below.
>
> I have three routes.
>
> First, I used the split streaming with a token "\n", reading a file splitted
> by line.
>
>  
> 
> 
> 
> 
> 
> 
>
>
> Then I made a business process :
>
> 
> 
> 
> 
> 
>
> public class ProcessBusiness {
>
>  public String dealRecord(@Body String body){
>  System.out.println(body);
>  return body;
> }
>
> And Finally,
>
> 
> 
> 
> 
> ${header.CamelFileName}.${header.CamelSplitIndex}
> 
> 
> 
> 
>
>public class ProcessStreamCaching {
>
>  public String usingStream(Exchange exchange){
>  Object o = exchange.getIn().getBody(StreamCache.class);
>  return  o.toString();
> }
>
> I wanted to get the whole file in this process (`ProcessStreamCaching`).
>
> How can i correctly use the stream cache ? How can i get read the file again
> from the beginning, that s why i want to use the stream cache.
>
> The file before splitting contain :
>
> X
> Y
> Z
> A
> 
> C
> 
> SSQQQ
> Z
> Z
>
>  I thought that the stream cache was able to put all line of the file in a
> cache, and i can retrieve these lines.
>
>  How can I see what is placed in the cache ?
>
>  I thought when i add  `streamCache="true"` at this route ` id="SPLIT-FLOW" >`, each line of the splitter will be placed on the cache.
> (or may be the whole file)
>
>  At the last process `ProcessStreamCaching`, if I wanted to reload the
> `inputStream` from the beginning , but at this process i can't because i
> have already read the `inputStream`.
>
>  I want to keep reading the file with streaming line per line, but at on
> process  I need to read for exemple the first line , that s why i wanted to
> use the stream cache , who allows me to browse the file from the beginning.
>
>  May be I misunderstand the Stream Cache.
>
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Using-Stream-Cache-With-Apache-Camel-tp5774856.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