How to consume old file first in SFTP ?

2013-04-03 Thread sarfaraj
Hi,

We need to consume file based on date modified.

We need to consumed old file first then latest.

I did sortBy=reverse:file:modifedbut still its consuming by name.

I also tried sortBy=file:modifed, but did not worked.

Can someone tell me how to consume old file first in SFTP consumer ?

Here is my from tag
from
uri=sftp://root@IP_X://tmp?password=amp;sortBy=reverse:file:modifedamp;noop=true;
/

/Sarfaraj




--
View this message in context: 
http://camel.465427.n5.nabble.com/How-to-consume-old-file-first-in-SFTP-tp5730253.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: CronSchedulePolicy with cxf endpoint

2013-04-03 Thread Richa
My route looks like this:

CronScheduledRoutePolicy cronScheduledRoutePolicy=new
CronScheduledRoutePolicy();
cronScheduledRoutePolicy.setRouteStartTime(0 0/3 * * * ?);

from(some sftp location)
.noAutoStartup()
.routePolicy(cronScheduledRoutePolicy)
.to(cxf location)



--
View this message in context: 
http://camel.465427.n5.nabble.com/CronSchedulePolicy-with-cxf-endpoint-tp5730206p5730254.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Only one cxf endpoint exposed using non-Spring CXF servlet

2013-04-03 Thread helander
Since I got no feedback on this, I wonder if I might have better luck with
posting this on the CXF User list?

Anyone that has successfully used the CXF non-spring servlet in combination
with Camel CXF consumers and that are willing to share how you made it to
work?

Thanks

Lars



--
View this message in context: 
http://camel.465427.n5.nabble.com/Only-one-cxf-endpoint-exposed-using-non-Spring-CXF-servlet-tp5730169p5730255.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Problem with Camel Jpa Component and Container Managed Transaction

2013-04-03 Thread doxumd
I need your help, I'm using pretty much the same example with a RouteTest
class and it does not work as expected because of the following line :

Bundle RouteTest is waiting for namespace handlers
[http://aries.apache.org/xmlns/jpa/v1.1.0]






--
View this message in context: 
http://camel.465427.n5.nabble.com/Problem-with-Camel-Jpa-Component-and-Container-Managed-Transaction-tp5714815p5730256.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Problem with Camel Jpa Component and Container Managed Transaction

2013-04-03 Thread doxumd
I need your help, I'm using pretty much the same example with a RouteTest
class and it does not work as expected because of the following line :

Bundle RouteTest is waiting for namespace handlers
[http://aries.apache.org/xmlns/jpa/v1.1.0]


I'm using the following blueprint.xml : 

?xml version=1.0 encoding=UTF-8?
blueprint xmlns=http://www.osgi.org/xmlns/blueprint/v1.0.0;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xmlns:camel=http://camel.apache.org/schema/blueprint;
   
xmlns:cm=http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0;
xmlns:jpa=http://aries.apache.org/xmlns/jpa/v1.1.0;
xsi:schemaLocation=
http://www.osgi.org/xmlns/blueprint/v1.0.0
http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://camel.apache.org/schema/blueprint
http://camel.apache.org/schema/blueprint/camel-blueprint.xsd
http://aries.apache.org/xmlns/jpa/v1.1.0
http://aries.apache.org/schemas/jpa/jpa_110.xsd;

bean id=jpa class=org.apache.camel.component.jpa.JpaComponent
jpa:unit unitname=persistence-pu property=entityManagerFactory
/
/bean

camelContext trace=true id=blueprintContext
xmlns=http://camel.apache.org/schema/blueprint;
route id=persist
from uri=direct:persist/
to uri=jpa:Person/
/route
/camelContext
/blueprint


and the following RouteTest.java

public class RouteTest extends CamelBlueprintTestSupport {

@Override
protected String getBlueprintDescriptor() {
return /OSGI-INF/blueprint/blueprint.xml;
}

@Test
public void testRoute() throws Exception {
getMockEndpoint(mock:result).expectedMinimumMessageCount(1);
ProducerTemplate producerTemplate = new
DefaultCamelContext().createProducerTemplate(); 
Person person = new Person();
person.setName(Bob);
producerTemplate.sendBody(direct:persist, person);

// assert expectations
assertMockEndpointsSatisfied();
}

}




--
View this message in context: 
http://camel.465427.n5.nabble.com/Problem-with-Camel-Jpa-Component-and-Container-Managed-Transaction-tp5714815p5730257.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Problem with Camel Jpa Component and Container Managed Transaction

2013-04-03 Thread Claus Ibsen
Hi

You would need to add to the classpath the Aries JPA JARs that has
that JPA stuff you use.
I am not sure which one has it but there is a bunch of Aries JPA JARs
http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.apache.aries.jpa%22


On Wed, Apr 3, 2013 at 9:49 AM, doxumd dox...@yahoo.com wrote:
 I need your help, I'm using pretty much the same example with a RouteTest
 class and it does not work as expected because of the following line :

 Bundle RouteTest is waiting for namespace handlers
 [http://aries.apache.org/xmlns/jpa/v1.1.0]


 I'm using the following blueprint.xml :

 ?xml version=1.0 encoding=UTF-8?
 blueprint xmlns=http://www.osgi.org/xmlns/blueprint/v1.0.0;
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xmlns:camel=http://camel.apache.org/schema/blueprint;

 xmlns:cm=http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0;
 xmlns:jpa=http://aries.apache.org/xmlns/jpa/v1.1.0;
 xsi:schemaLocation=
 http://www.osgi.org/xmlns/blueprint/v1.0.0
 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
 http://camel.apache.org/schema/blueprint
 http://camel.apache.org/schema/blueprint/camel-blueprint.xsd
 http://aries.apache.org/xmlns/jpa/v1.1.0
 http://aries.apache.org/schemas/jpa/jpa_110.xsd;

 bean id=jpa class=org.apache.camel.component.jpa.JpaComponent
 jpa:unit unitname=persistence-pu property=entityManagerFactory
 /
 /bean

 camelContext trace=true id=blueprintContext
 xmlns=http://camel.apache.org/schema/blueprint;
 route id=persist
 from uri=direct:persist/
 to uri=jpa:Person/
 /route
 /camelContext
 /blueprint


 and the following RouteTest.java

 public class RouteTest extends CamelBlueprintTestSupport {

 @Override
 protected String getBlueprintDescriptor() {
 return /OSGI-INF/blueprint/blueprint.xml;
 }

 @Test
 public void testRoute() throws Exception {
 getMockEndpoint(mock:result).expectedMinimumMessageCount(1);
 ProducerTemplate producerTemplate = new
 DefaultCamelContext().createProducerTemplate();
 Person person = new Person();
 person.setName(Bob);
 producerTemplate.sendBody(direct:persist, person);

 // assert expectations
 assertMockEndpointsSatisfied();
 }

 }




 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Problem-with-Camel-Jpa-Component-and-Container-Managed-Transaction-tp5714815p5730257.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
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


Re: How to consume old file first in SFTP ?

2013-04-03 Thread Claus Ibsen
Hi

Some ftp clients cannot get the modification timestamp very precisely.
Maybe only it can get hours and minutes.

You can try enabling the tracer
http://camel.apache.org/tracer

And look for the CamelFileLastModified header which has the
modification timestamp, and see what values it has for the files.
This is the value Camel uses for the sortBy.


On Wed, Apr 3, 2013 at 8:05 AM, sarfaraj sarfarajsay...@gmail.com wrote:
 Hi,

 We need to consume file based on date modified.

 We need to consumed old file first then latest.

 I did sortBy=reverse:file:modifedbut still its consuming by name.

 I also tried sortBy=file:modifed, but did not worked.

 Can someone tell me how to consume old file first in SFTP consumer ?

 Here is my from tag
 from
 uri=sftp://root@IP_X://tmp?password=amp;sortBy=reverse:file:modifedamp;noop=true;
 /

 /Sarfaraj




 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/How-to-consume-old-file-first-in-SFTP-tp5730253.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
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


Re: Camel file component preMove creates directory before read lock acquired?

2013-04-03 Thread Claus Ibsen
Yeah the current logic is that preMove will move the file first.

I guess we could consider acquiring the lock first, and then do the
preMove afterwards.
I have logged a ticket about this
https://issues.apache.org/jira/browse/CAMEL-6235


On Mon, Apr 1, 2013 at 8:37 PM, icemanltd iceman...@hotmail.com wrote:
 This behavior is causing an issue. I have specified
 preMove=temp/${exchangeID} with noop=true idempotent=false and
 readLock=rename. I was expecting that the lock would first be acquired, then
 the file moved to the preMove directory and then processing would begin and
 eventually end leaving the file in the preMove directory.

 If I ensure the file cannot be renamed (by opening the file in an editor
 that holds an exclusive lock on the file), I will get a number of empty
 directories being created under the temp directory. Finally when I release
 the lock the file will moved to the appropriate directory under temp.

 Am I doing something wrong, what is the behavior I should expect?



 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Camel-file-component-preMove-creates-directory-before-read-lock-acquired-tp5728193p5730176.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
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


Re: It is possible with Camel to use dynamic consumer? **after context start**

2013-04-03 Thread Claus Ibsen
You may want to see a little about consumer template here
http://camel.apache.org/polling-consumer.html

Notice the the consumer template polls one message at a time.

If you want to download all available files you would need to run
the code in a while loop as the example on that link.

Though you can also add a new route at runtime with the from uri
computed. And then stop and remove the route if not longer needed.


On Tue, Apr 2, 2013 at 9:36 PM, Chris Wolf cwolf.a...@gmail.com wrote:
 May I have the ticket #?  (so I can watch/follow)

 When you say, use a java bean - what do you mean?

 Instantiate the FTP component like?

 FtpComponent comp = new FtpComponent(context);
 @SuppressWarnings(unchecked)
 FtpEndpointFTPFile endpt = (FtpEndpointFTPFile)

 comp.createEndpoint(ftp://localhost/download?localWorkDirectory=/tmp/local/datanoop=trueusername=fredpassword=secret;);
 final FtpConsumer cons = (FtpConsumer)
 endpt.createConsumer(new Processor() {
 @Override
 public void process(Exchange exchange)
 throws Exception {
 System.out.printf(%s\n,
 exchange.toString());
 }
 });
 cons.setStartScheduler(true);
 comp.start();
 endpt.start();
 cons.start();

 On Tue, Apr 2, 2013 at 11:03 AM, Claus Ibsen claus.ib...@gmail.com wrote:
 Hi

 There is a ticket scheduled for Camel 3.0 to allow enrich and
 pollEnrich to support dynamic uris like the recipient list can do.

 Though implementing this requires an API change and thus scheduled for 3.0.

 You can always use a java bean to consume from an dynamic computed
 endpoint. For example using consumer template etc.

 For ftp endpoints you may want to set disconnect=true, to avoid having
 the connection running for a longer period.




 On Sun, Mar 31, 2013 at 10:08 PM, Chris Wolf cwolf.a...@gmail.com wrote:
 Claus,

 You addressed the issue of dynamic URIs for Consumers back in July-2009:

 http://camel.465427.n5.nabble.com/Dynamic-consumers-with-Camel-td476433.html

 However, all those use-cases, except for maybe #4, web console, which
 I can't run all are about
 calculating the URI *before* the context is started.  What I'm looking
 for is a way to create and insert
 or update a polling consumer's URI - at runtime - *after* the context
 is started.

 For example:

  from(direct:start)
 .beanRef(config)
 .convertBodyTo(Document.class)
 .setHeader(Ftp_URI).xquery(
 concat('ftp://' +...some more xpaths into the
 inbound config doc...), String.class)
  .pollEnrich(/* whoops! this is referenced at route
 setup time, not route runtime... - it won't work */)
  .to(log:...);

 So the question, more generally, is is it possible to alter the route
 definition - at runtime? i.e. after the route/context are started?

 You sorted of hinted at this in that July-2009 posting when you said:

 2) You can always stop, modify and start a route in Camel at runtime.

 I don't see how that would work since I would likely be attempting to
 modify the route at runtime
 from a bean method in the route - or are you suggesting one route
 stops/modifies another route?

 So the way I see it is - I would create the ftp route with a bogus URI
 and option startScheduler=false,
 on the ftp endpoint, or autoStart=false on the route.  Then in
 *another* route - the configurer route,
 I guess, access the ftp route and reconfigure the endpoint with the
 real settings, then start it's poll scheduler (or start it's route).

 Something like that?  Any easier, more direct way?

 Thanks,


 Chris



 --
 Claus Ibsen
 -
 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.
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


Re: how to do a registry of type: javax.sql.DataSource

2013-04-03 Thread Claus Ibsen
Yes you can use the bind method on the Main class to bind a bean to
the registry.



On Sun, Mar 24, 2013 at 10:09 AM, pitabwire bwire...@gmail.com wrote:
 Hi Mr claus you could just bind the datasource to the default camel runner if
 you are not using any containers to run your route as shown below.



 package com.notifications;

 import org.apache.camel.main.Main;

 /**
  * A drops notifications .
  */
 public class StartupManager {

 /**
  * A main() so we can easily run these routing rules in our IDE
  */
 public static void main(String... args) throws Exception {
 Main main = new Main();
main.enableHangupSupport();



   DriverManagerDataSource ds = new DriverManagerDataSource();

   ds.setDriverClassName(com.mysql.jdbc.Driver);
 ds.setUrl(jdbc:mysql://localhost:3306/examen);
 ds.setUsername(root);
 ds.setPassword();

main.bind(datasource, ds);


 //Configure routes for operations.


  //Then start the routes...
  main.run(args);



 }
 }











 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/how-to-do-a-registry-of-type-javax-sql-DataSource-tp5729644p5729730.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
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


Re: FTP2: use SFTP with private key not stored in file

2013-04-03 Thread Claus Ibsen
Hi

I am not sure. Though we love contributions, so feel free to log a
JIRA and/or work on a patch to add this functionality.
For example with some interface that allows end users to implement a
custom code how to obtain their keys.
http://camel.apache.org/contributing.html

On Fri, Mar 15, 2013 at 5:16 PM, mdo manfred.doh...@gmail.com wrote:
 Hello,

 for the SFTP scheme one can use the privateKeyFile option in order to use
 key authentication. I've seen that the Jsch library also has an
 addIdentity() method where you can supply byte arrays with public and
 private key data. Is there any chance of using private keys not stored onto
 disk? In my use case the private keys come from a database. Is there a
 camel'ish way of getting these keys into play? I've not enough insight into
 camel to assess if there's a solution involving only minor effort.

 Thanks in advance!
 mdo





 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/FTP2-use-SFTP-with-private-key-not-stored-in-file-tp5729260.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
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


camel-elasticsearch option to connect to remote cluster

2013-04-03 Thread barthorre
Hi there,

I was wondering if there is an option (or should be implemented) to be able
to connect to a remote cluster.
It should provide the same functionality like that java api for ES:

new TransportClient(settings).addTransportAddress(new
InetSocketTransportAddress(ip, 9300))


I tried to run a local test with my machine in 10.1.15.x range and the
cluster in 10.1.10.x range and my remote cluster was not found.

With the current available parameters you can only specify the clustername,
but when the cluster isn't in the same subnet it won't be discovered. 


Or maybe I am missing something and I got it all wrong?



--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-elasticsearch-option-to-connect-to-remote-cluster-tp5730270.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: How to consume old file first in SFTP ?

2013-04-03 Thread sarfaraj
But looks like sortBy=file:modified consumed the old file first and
sortBy=reverse:file:modified consumed the latest first.


I got confused now :)

I need to use *sortBy=file:modified* to consumed old file right ? Please
confirm ?



--
View this message in context: 
http://camel.465427.n5.nabble.com/How-to-consume-old-file-first-in-SFTP-tp5730253p5730269.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: How to consume old file first in SFTP ?

2013-04-03 Thread sarfaraj
Ok, If I use sortBy=reverse:file:modified then it will take old file first
then latest ...right ?



--
View this message in context: 
http://camel.465427.n5.nabble.com/How-to-consume-old-file-first-in-SFTP-tp5730253p5730267.html
Sent from the Camel - Users mailing list archive at Nabble.com.


placeholder in from uri

2013-04-03 Thread Olivier Lamy
Hi,

I'd like to be able to use something like:

from uri={{productImport.uri.location}} /

But I have issues with that.
Exception:
Caused by: org.apache.camel.NoSuchEndpointException: No endpoint could
be found for: {{productImport.uri.location}}, please check your
classpath contains the needed Camel component jar.

more details available here: https://gist.github.com/olamy/5298824

Is it possible to use a placeholder for the whole uri ?
Or the scheme (sftp, etc) is a minimum requited ?

Thanks
--
Olivier Lamy
Ecetera: http://ecetera.com.au
http://twitter.com/olamy | http://linkedin.com/in/olamy


Re: placeholder in from uri

2013-04-03 Thread Claus Ibsen
Hi

You can use {{ }} in the .properties file then Camel will pick that up.

Support for using nested Spring ${ } is being tracked by
https://issues.apache.org/jira/browse/CAMEL-6233

And added in upcoming releases.


On Wed, Apr 3, 2013 at 1:50 PM, Olivier Lamy ol...@apache.org wrote:
 Hi,

 I'd like to be able to use something like:

 from uri={{productImport.uri.location}} /

 But I have issues with that.
 Exception:
 Caused by: org.apache.camel.NoSuchEndpointException: No endpoint could
 be found for: {{productImport.uri.location}}, please check your
 classpath contains the needed Camel component jar.

 more details available here: https://gist.github.com/olamy/5298824

 Is it possible to use a placeholder for the whole uri ?
 Or the scheme (sftp, etc) is a minimum requited ?

 Thanks
 --
 Olivier Lamy
 Ecetera: http://ecetera.com.au
 http://twitter.com/olamy | http://linkedin.com/in/olamy



-- 
Claus Ibsen
-
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


Re: It is possible with Camel to use dynamic consumer? **after context start**

2013-04-03 Thread Chris Wolf
I actually was basing my current attempts based on what I read on that
page.  I thought if you used
a ScheduledPollingConsumer, that it would loop for you and didn't need
a while-loop.

I will just try plain PollingConsumer in a while-loop.

BTW, I found the ticket for dynamic URIs for FTP consumers:  CAMEL-4596

Thanks,


Chris

On Wed, Apr 3, 2013 at 5:07 AM, Claus Ibsen claus.ib...@gmail.com wrote:
 You may want to see a little about consumer template here
 http://camel.apache.org/polling-consumer.html

 Notice the the consumer template polls one message at a time.

 If you want to download all available files you would need to run
 the code in a while loop as the example on that link.

 Though you can also add a new route at runtime with the from uri
 computed. And then stop and remove the route if not longer needed.


 On Tue, Apr 2, 2013 at 9:36 PM, Chris Wolf cwolf.a...@gmail.com wrote:
 May I have the ticket #?  (so I can watch/follow)

 When you say, use a java bean - what do you mean?

 Instantiate the FTP component like?

 FtpComponent comp = new FtpComponent(context);
 @SuppressWarnings(unchecked)
 FtpEndpointFTPFile endpt = (FtpEndpointFTPFile)

 comp.createEndpoint(ftp://localhost/download?localWorkDirectory=/tmp/local/datanoop=trueusername=fredpassword=secret;);
 final FtpConsumer cons = (FtpConsumer)
 endpt.createConsumer(new Processor() {
 @Override
 public void process(Exchange exchange)
 throws Exception {
 System.out.printf(%s\n,
 exchange.toString());
 }
 });
 cons.setStartScheduler(true);
 comp.start();
 endpt.start();
 cons.start();

 On Tue, Apr 2, 2013 at 11:03 AM, Claus Ibsen claus.ib...@gmail.com wrote:
 Hi

 There is a ticket scheduled for Camel 3.0 to allow enrich and
 pollEnrich to support dynamic uris like the recipient list can do.

 Though implementing this requires an API change and thus scheduled for 3.0.

 You can always use a java bean to consume from an dynamic computed
 endpoint. For example using consumer template etc.

 For ftp endpoints you may want to set disconnect=true, to avoid having
 the connection running for a longer period.




 On Sun, Mar 31, 2013 at 10:08 PM, Chris Wolf cwolf.a...@gmail.com wrote:
 Claus,

 You addressed the issue of dynamic URIs for Consumers back in July-2009:

 http://camel.465427.n5.nabble.com/Dynamic-consumers-with-Camel-td476433.html

 However, all those use-cases, except for maybe #4, web console, which
 I can't run all are about
 calculating the URI *before* the context is started.  What I'm looking
 for is a way to create and insert
 or update a polling consumer's URI - at runtime - *after* the context
 is started.

 For example:

  from(direct:start)
 .beanRef(config)
 .convertBodyTo(Document.class)
 .setHeader(Ftp_URI).xquery(
 concat('ftp://' +...some more xpaths into the
 inbound config doc...), String.class)
  .pollEnrich(/* whoops! this is referenced at route
 setup time, not route runtime... - it won't work */)
  .to(log:...);

 So the question, more generally, is is it possible to alter the route
 definition - at runtime? i.e. after the route/context are started?

 You sorted of hinted at this in that July-2009 posting when you said:

 2) You can always stop, modify and start a route in Camel at runtime.

 I don't see how that would work since I would likely be attempting to
 modify the route at runtime
 from a bean method in the route - or are you suggesting one route
 stops/modifies another route?

 So the way I see it is - I would create the ftp route with a bogus URI
 and option startScheduler=false,
 on the ftp endpoint, or autoStart=false on the route.  Then in
 *another* route - the configurer route,
 I guess, access the ftp route and reconfigure the endpoint with the
 real settings, then start it's poll scheduler (or start it's route).

 Something like that?  Any easier, more direct way?

 Thanks,


 Chris



 --
 Claus Ibsen
 -
 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.
 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


Re: Splitter, Aggregation and Timeouts

2013-04-03 Thread dtauzell
Thanks,

Is there a way to have the multicast send some sort of parameter to the
direct endpoints so they can all act slightly differently based on that?  

Based on the incoming message I will look up N member ids.  Each of those
ids will result in a message being sent to an external web service.  Those
message will all be different based on configuration data assoicated with
the member ids.

-Dave



--
View this message in context: 
http://camel.465427.n5.nabble.com/Splitter-Aggregation-and-Timeouts-tp5730087p5730282.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Enable to use default scope beans

2013-04-03 Thread Gardella juan
Hi,

For example I have a bean:

@Component(myBean)
public class MyBean{
 
 public void foo(){
 }
 
}

And the route:

from(...).to(bean:myBean)

And works, but if I change the visibilty of MyBean to package fails:

@Component(myBean)
class MyBean{
 
 public void foo(){
 }
 
}

The route fails. I 've create the jira
https://issues.apache.org/jira/browse/CAMEL-6206, but was closed because it
was not very clear.

Thanks,
Juan






--
View this message in context: 
http://camel.465427.n5.nabble.com/Enable-to-use-default-scope-beans-tp5730283.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Callback after startup from org.apache.camel.main.Main afterStart()

2013-04-03 Thread Andrew Bailey
I have a use case, where I require a fast startup time for camel and wish
to avoid classpath scanning.
I use the Main class however it appears that its not possible to obtain a
ProducerTemplate template = getCamelTemplate();
before calling the run method. (it produces an ArrayOutOfBounds exception -
I could file a bug for that if you like)

What I did was to extend Main (see code fragment below) and add a callback
called from the afterStart() method, so that user code can access the
context, and TypeConverterRegistry (as before that it is not initialized).

Is there a better way to do it?

If not and the developers think its a good idea, I would like to contribute
the code for a future release.


Thanks

Andy


import org.apache.camel.main.Main;

public class ServiceManager extends Main {


public static void main(String[] args) throws Exception {
ServiceManager example = new ServiceManager();
example.boot();
}

public void boot() throws Exception {
//cut

 setAfterStartCallback(new CallableVoid(){
public Void call() throws Exception
{
ProducerTemplate template = getCamelTemplate();

fileMonitor.setProducer(template);

   /*
   ListCamelContext contexts=getCamelContexts();
   System.out.println(contexts);
   CamelContext context=contexts.get(0);
   TypeConverterRegistry converterRegistry =
context.getTypeConverterRegistry();
   TypeConverter converter =
converterRegistry.lookup(String[].class, String.class);
   System.out.println(Converter +converter);

   TypeConverter converter2 =
converterRegistry.lookup(List.class, String.class);
   System.out.println(Converter +converter2);

   */
   return null;
}
});
//code cut
 System.out.println(Starting Camel. Use ctrl + c to terminate the
JVM.\n);
run();
}

private CallableVoid afterStartCallback;

@Override
protected void afterStart() throws Exception {

if (afterStartCallback!=null) afterStartCallback.call();
}

public CallableVoid getAfterStartCallback() {
return afterStartCallback;
}

public void setAfterStartCallback(CallableVoid
afterStartCallback) {
this.afterStartCallback = afterStartCallback;
}
}

-- 



Andrew Bailey
Cel - 312 866 95 56

http://www.apps4u.co
Chat Skype: apps4u
Twitter @apps4uco


Camel/JMS with Atomikos UserTransactionManager not consuming Messages

2013-04-03 Thread yxzhao
Hi All,

We have an app using Camel to schedule jobs and Atomikos to manage
transactions accessing IBM MQ queues and Oracle DB. Once a while message
consuming routes stop consuming messages completely without indication of
any abnormal conditions.

Does anyone out there experience this or something similar? 

By the way, when Atomikos manages transactions, do camel routes have to
specify transacted work explicitly or Atomikos can detect the units of work
automatically based on route definitions?

Thanks in advance for any help, hints or suggestions.







--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-JMS-with-Atomikos-UserTransactionManager-not-consuming-Messages-tp5730286.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: spring-ws timeout question

2013-04-03 Thread Smith-John
Hi,

unfortunately I didn't find a answer to my question.
In the spring ws documentation I read something about timeout settings and
callbacks.
But the question is: how does camel use/apply this things exactly.
Does camel maybe just set the timeout to infinite or does camel use callback
possibilities?



--
View this message in context: 
http://camel.465427.n5.nabble.com/spring-ws-timeout-question-tp5730111p5730287.html
Sent from the Camel - Users mailing list archive at Nabble.com.


xslt: TransformerException: include href is empty

2013-04-03 Thread per.ce...@gmail.com
Hi

Have a problem when I use xlst and have a xls that contains the function
document(‘’).
For ex.
xsl:variable name=month-node
select=document('')/*/date:months/date:month[number(2)]/

This gives an exception like:  javax.xml.transform.TransformerException:
include href is empty

I have tried to use saxon, according to
http://camel.465427.n5.nabble.com/xslt-error-with-document-td5713535.html,
without any success.

My route:
from uri=file:./xmlin/rcv/?move=./../inp/

to uri=xslt:DocTest.xsl/

I’m stuck, grateful for any help…

Regards, Per 




--
View this message in context: 
http://camel.465427.n5.nabble.com/xslt-TransformerException-include-href-is-empty-tp5730288.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel routing issue

2013-04-03 Thread Prabu
Hi Chris,

I used your code.But i am getting following compilation error

lder.java:92: cannot find symbol
symbol  : method setHeader(java.lang.String,java.lang.String)
location: class org.apache.camel.model.ChoiceDefinition
  .otherwise().setHeader(MyHeader,sdfsdf)


*Note: *I am using camel 2.10 version



On Wed, Apr 3, 2013 at 8:22 PM, Chris Wolf cwolf.a...@gmail.com wrote:

 Hi Prabu,

 I don't mind helping, but could you continue to use the
 users@camel.apache.org rather then my private email?  That way, if
 other people have similar issues, they can benefit.


 from(GMD_TEST_TYPE_SPECIFIC_QNAME).choice(
.when(TEST_EVENT_PREDICATE).to(LOGGING_HANDLER_QNAME)
.otherwise()
.setHeader(MyHeader, constant(some-value))  // === Set
 Header
.to(ERQ_QNAME)
.end();

 This technique will use the simple language function constant to
 set a string constant value.
 If the value you need to set is dynamic, then you could use a
 property placeholder.

 from(GMD_TEST_TYPE_SPECIFIC_QNAME).choice(
.when(TEST_EVENT_PREDICATE).to(LOGGING_HANDLER_QNAME)
.otherwise()
.setHeader(MyHeader, constant({{some-prop}}))  // === Set
 Header
.to(ERQ_QNAME)
.end();

 There are even more sophisticated ways to acquire dynamic values:

 http://camel.apache.org/python.html

 Regards,

 Chris

 On Wed, Apr 3, 2013 at 9:52 AM, Prabu prabumc...@gmail.com wrote:
  I have code like this,
 
  from(GMD_TEST_TYPE_SPECIFIC_QNAME).choice()
.when(TEST_EVENT_PREDICATE).to(LOGGING_HANDLER_QNAME)
.otherwise().to(ERQ_QNAME)
 .end();
 
  from(DEACTIVATIN_TYPE_SPECIFIC_QNAME).choice()
.when(ALERT_FAILURE_HANDLER_PREDICATE).to(ALERT_FAILURE_QNAME)
.otherwise().to(ERQ_QNAME)
  .end();
 
  I want to set some values to header inside otherwise that is before
 message
  move to ERQ_QNAME.
 
  please kindly help me how to do that.
 
  Regards
  Prabu.N
 
 
  On Tue, Apr 2, 2013 at 10:52 PM, Prabu prabumc...@gmail.com wrote:
 
  No,i didn't received ...
 
  Regards
  Prabu.N
 
 
  On Tue, Apr 2, 2013 at 7:31 PM, Chris Wolf cwolf.a...@gmail.com
 wrote:
 
  Hi Prabu,
 
  Just out of curiosity - I am wondering if saw my email I sent
  yesterday in response to your question?
  I sent it to users@camel.apache.org with the subject,
  Content-based routing with Expressions and Predicates...
 
  Regards,
 
  Chris
 
  On Tue, Apr 2, 2013 at 4:17 AM, prabumc...@gmail.com
  prabumc...@gmail.com wrote:
   I have found solution in internet using Predicate  we can achieve
 this,
  
   But,one doubt in the link
   http://camel.apache.org/predicate.html,Theymentioned that we can use
   AND and OR in Predicate
  
   I have added below code in project,But i am getting compilation
   error.Please kindly help
  
   *Predicate god = and(admin, or(body().contains(Camel Rider),
   header(type).isEqualTo(god)));*
  
   *Thanks*
   Prabu.N
  
  
   On Mon, Apr 1, 2013 at 9:05 PM, Prabu prabumc...@gmail.com wrote:
  
   Hi *Chris / **Claus*,
  
   I have one *Inbound* queue,based on header and content type,I want
   forward to outbound queue.
   *
   Example 1:
   *
   *
   Inbound.queue name : **Inbound.Test.DDD
   Outbound.queue name : SOURHQueueName
  
   *
   *Criteria or Condition :
   *
   Message property *PAST_EVENT_INTERVAL type* is : *0*
  *AND*
   Message *Type* value is : *card.test *or* card.expiry.test*
  
   *Example 2:*
  
   *Inbound.queue name : **Inbound.Test.SSS
   Outbound.queue name : WESTQueueName
   *
   *Criteria or Condition :*
   Message property *PAST_EVENT_INTERVAL type* is : *0*
*AND
   *
   Message *Type *value *start with* :*card.event*
  
   I want achieve this using camel routing java DSL.
  
   Please help me.How can i use AND,OR and regular expression in camel
   routing
  
   *Regards*
   Prabu.N
  
  
   On Mon, Apr 1, 2013 at 7:43 PM, Chris Wolf [via Camel] 
   ml-node+s465427n5730166...@n5.nabble.com wrote:
  
   Hi Claus,
  
   Thanks for the response - I could not see any obvious way to
   configure
   an FTP Consumer at ***runtime***,
   either via bean, processor or consumer template.  If you have a
   concrete example, that would be great to see...
  
   ...otherwise, here's the solution I came up with:
  
  
   -Chris
  
  
  
 // simulate incoming message from JMS...
 from(timer:kickoff?repeatCount=1)
 .to(direct:start);
  
 // upon receipt of FTP config from JMS, invoke  FtpConfigurer
 bean
   to reconfigure
 // FTP route, then start it...
 from(direct:start)
 .beanRef(configRdr) // config reader bean not shown here
 .convertBodyTo(Document.class)
 // sets a bunch of headers from DOM, e.g.:
  
  
  
 .setHeader(ftp-config.host).xquery(//remote[remoteId/@value='CBOE34']/server/@value,
  
   String.class)
 .setHeader(ftp-route-id, constant(ftp.route))
 .beanRef(ftpConfigurer);
  
 // FTP route 

Re: Deleting MQ Temporary Queue

2013-04-03 Thread PhilBurress
For MQ we had to create a temporary dynamic model queue, which is specified
in the queue connection factory. Example from one of our integration tests:

... and in the route...

So it uses the same model queue each time. It appears that Camel will
attempt to reuse the temporary queues it creates and it only creates
additional temporary queues as needed (under load). The queues do eventually
get deleted when the application shuts down, but I think we're looking for
something which will actively poll for unused temporary queues and remove
them as appropriate.

We are using Camel 2.10.1 with MQ version 7.0.x



--
View this message in context: 
http://camel.465427.n5.nabble.com/Deleting-MQ-Temporary-Queue-tp5730231p5730290.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Transactional batching

2013-04-03 Thread Scott England-Sullivan
Hi Ben,

Currently only SJMS (2.11.0) has support for batching of JMS transactions
(local only, no XA).  The consumer has natural batch support meaning that
you set the number of messages you would like read before issuing a commit.
 You can also specify a timeout, default is 5000ms, to keep the consumer
from holding the transaction open if you have a bursty message flow.

On the producer side SJMS is able to support using a List of Objects or
SJMS BatchMessage objects where the producer will iterate through the list
and if configured for transactions, commit or rollback the transaction.
 This is necessary at this time since using a batch on the producer would
potentially cause the initial consumer to loose visibility of what messages
have been lost in the event of a rollback.  This would work well when using
a ProducerTemplate in an application that collects a given number of
messages and then publishes the collection.

There currently isn't support for XA but that can be mitigated by having
applications monitor for the JMSRedelivery=true header.

Let me know if this answers your question.

Best Regards,
Scott ES


On Tue, Apr 2, 2013 at 11:02 PM, boday ben.o...@initekconsulting.comwrote:

 this is a really old thread, but I'm wondering if anyone has any updated
 ideas on this...I have a similar requirement to read from an AMQ queue,
 batch X messages together and then process.  I'm currently doing this with
 the aggregator/hawtdb repo combination but performance is proving too
 slow...

 I'd think it would be faster/cleaner to just be able to read multiple from
 the queue in a transaction, aggregate together, process, then end the
 transaction...

 any ideas?


 David J. M. Karlsen wrote
  Looking at this thread I wonder the same.
 
  During a resource local jmstransaction you are able to fetch several
  messages - but there is no way in camel to control the commit size.
  You can do the same during a XA tx.
 
  I see no support for batching here:
  http://camel.apache.org/batch-consumer.html.
 
  Either transaction mode would benefit a lot if you could process several
  messages in one go.
 
  Typical usecase would be tx( N messages, process them in paralell,
  aggregate and send out )





 -
 Ben O'Day
 IT Consultant -http://consulting-notes.com

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




-- 
-- 
Scott England-Sullivan
Apache Camel Committer
Principal Consultant / Sr. Architect | Red Hat, Inc.
FuseSource is now part of Red Hat
Web: fusesource.com http://www.fusesource.com |
redhat.comhttp://www.redhat.com
Blog: sully6768.blogspot.com
Twitter: sully6768


Dynamic routing in Camel

2013-04-03 Thread mayank.gupta
Hi All , 

I am using Spring DSL for routing in Camel. I have to route the messages
from transmitter(processor) to multiple queues in which one queue is map to
one circle at a time. So for that i have to create routes for each queue.Is
there any way to pass the queue name dynamically in the camel:from uri=/
? so we can define the single route instead of multiple routes. We can't use
the property holder because the queue name selection depends only run time. 

I am using following entry for single queue route : 

camel:route id=routetx
camel:from uri=bean:sendsms?method=sendMsg/
camel:from uri=jms:queue:smsQueueOut/ - Here can we use EL
expression to get the queue name dynamically ex. ${header.QUEUE_NAME} or is
there any other way to pass the header or property? 
camel:to uri=direct:SMPPServer/
/camel:route



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


Failed to load type converters because of: Cannot find any type converter classes from the following packages: [org.apache.activemq.camel.converter]

2013-04-03 Thread sarfaraj
Hi,

I got following error  I am usning servicemix 4.4.2 V, which has camel
2.8.5.

Could someone tell me what is wrong with my app ?



19:14:36,454 | ERROR | ExtenderThread-4 | ContextLoaderListener|
76 - org.springframework.osgi.extender - 1.2.1 | Application context refresh
failed (OsgiBundleXmlApplicationContext(bundle=my-camel-context,
config=osgibundle:/META-INF/spring/*.xml))
org.apache.camel.RuntimeCamelException:
org.apache.camel.TypeConverterLoaderException: Failed to load type
converters because of: Cannot find any type converter classes from the
following packages: [org.apache.activemq.camel.converter]
at
org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1171)[91:org.apache.camel.camel-core:2.8.5]
at
org.apache.camel.impl.DefaultCamelContext.getTypeConverter(DefaultCamelContext.java:996)[91:org.apache.camel.camel-core:2.8.5]
at
org.apache.camel.impl.DefaultCamelContext.getTypeConverterRegistry(DefaultCamelContext.java:1011)[91:org.apache.camel.camel-core:2.8.5]
at
org.apache.camel.impl.DefaultCamelContext.forceLazyInitialization(DefaultCamelContext.java:1971)[91:org.apache.camel.camel-core:2.8.5]
at
org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1445)[91:org.apache.camel.camel-core:2.8.5]
at
org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1357)[91:org.apache.camel.camel-core:2.8.5]
at
org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:178)[94:org.apache.camel.camel-spring:2.8.5]
at
org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)[91:org.apache.camel.camel-core:2.8.5]
at
org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)[91:org.apache.camel.camel-core:2.8.5]
at
org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1325)[91:org.apache.camel.camel-core:2.8.5]
at
org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:223)[94:org.apache.camel.camel-spring:2.8.5]
at
org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:117)[94:org.apache.camel.camel-spring:2.8.5]
at
org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:240)[94:org.apache.camel.camel-spring:2.8.5]
at
org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97)[65:org.springframework.context:3.0.6.RELEASE]
at
org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:303)[65:org.springframework.context:3.0.6.RELEASE]
at
org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:911)[65:org.springframework.context:3.0.6.RELEASE]
at
org.springframework.osgi.context.support.AbstractOsgiBundleApplicationContext.finishRefresh(AbstractOsgiBundleApplicationContext.java:235)[73:org.springframework.osgi.core:1.2.1]
at
org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:358)[73:org.springframework.osgi.core:1.2.1]
at
org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)[73:org.springframework.osgi.core:1.2.1]
at
org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)[73:org.springframework.osgi.core:1.2.1]
at
org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132)[76:org.springframework.osgi.extender:1.2.1]
at java.lang.Thread.run(Thread.java:662)[:1.6.0_25]
Caused by: org.apache.camel.TypeConverterLoaderException: Failed to load
type converters because of: Cannot find any type converter classes from the
following packages: [org.apache.activemq.camel.converter]
at
org.apache.camel.impl.converter.AnnotationTypeConverterLoader.load(AnnotationTypeConverterLoader.java:117)[91:org.apache.camel.camel-core:2.8.5]
at
org.apache.camel.impl.converter.BaseTypeConverterRegistry.loadTypeConverters(BaseTypeConverterRegistry.java:453)[91:org.apache.camel.camel-core:2.8.5]
at
org.apache.camel.impl.converter.DefaultTypeConverter.doStart(DefaultTypeConverter.java:42)[91:org.apache.camel.camel-core:2.8.5]
at
org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)[91:org.apache.camel.camel-core:2.8.5]
at
org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)[91:org.apache.camel.camel-core:2.8.5]
at
org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:56)[91:org.apache.camel.camel-core:2.8.5]
at

Way to determine if Route is running or not

2013-04-03 Thread vishal1981
Hi,
Is there a way to query the CamelContext to find out if a route is running
or not, as in, if a route is currently processing an exchange or a consumer
endpoint of the route such as FTP or File is in the process of retrieving a
file.
I modify the routes with certain settings from the UI. Hence I need to know
if a route is running or not before I tear it down and recreate it with new
settings.
thanks in advance,
-v-



--
View this message in context: 
http://camel.465427.n5.nabble.com/Way-to-determine-if-Route-is-running-or-not-tp5730299.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: It is possible with Camel to use dynamic consumer? **after context start**

2013-04-03 Thread Chris Wolf
Sorry, but I'm still a little confused...

Can you compare and contrast EventDrivenPollingConsumer vs.
ScheduledBatchPollingConsumer?

They both seem to support reading multiple times in an exchange...

Thanks,

Chris

On Wed, Apr 3, 2013 at 5:07 AM, Claus Ibsen claus.ib...@gmail.com wrote:
 You may want to see a little about consumer template here
 http://camel.apache.org/polling-consumer.html

 Notice the the consumer template polls one message at a time.

 If you want to download all available files you would need to run
 the code in a while loop as the example on that link.

 Though you can also add a new route at runtime with the from uri
 computed. And then stop and remove the route if not longer needed.


 On Tue, Apr 2, 2013 at 9:36 PM, Chris Wolf cwolf.a...@gmail.com wrote:
 May I have the ticket #?  (so I can watch/follow)

 When you say, use a java bean - what do you mean?

 Instantiate the FTP component like?

 FtpComponent comp = new FtpComponent(context);
 @SuppressWarnings(unchecked)
 FtpEndpointFTPFile endpt = (FtpEndpointFTPFile)

 comp.createEndpoint(ftp://localhost/download?localWorkDirectory=/tmp/local/datanoop=trueusername=fredpassword=secret;);
 final FtpConsumer cons = (FtpConsumer)
 endpt.createConsumer(new Processor() {
 @Override
 public void process(Exchange exchange)
 throws Exception {
 System.out.printf(%s\n,
 exchange.toString());
 }
 });
 cons.setStartScheduler(true);
 comp.start();
 endpt.start();
 cons.start();

 On Tue, Apr 2, 2013 at 11:03 AM, Claus Ibsen claus.ib...@gmail.com wrote:
 Hi

 There is a ticket scheduled for Camel 3.0 to allow enrich and
 pollEnrich to support dynamic uris like the recipient list can do.

 Though implementing this requires an API change and thus scheduled for 3.0.

 You can always use a java bean to consume from an dynamic computed
 endpoint. For example using consumer template etc.

 For ftp endpoints you may want to set disconnect=true, to avoid having
 the connection running for a longer period.




 On Sun, Mar 31, 2013 at 10:08 PM, Chris Wolf cwolf.a...@gmail.com wrote:
 Claus,

 You addressed the issue of dynamic URIs for Consumers back in July-2009:

 http://camel.465427.n5.nabble.com/Dynamic-consumers-with-Camel-td476433.html

 However, all those use-cases, except for maybe #4, web console, which
 I can't run all are about
 calculating the URI *before* the context is started.  What I'm looking
 for is a way to create and insert
 or update a polling consumer's URI - at runtime - *after* the context
 is started.

 For example:

  from(direct:start)
 .beanRef(config)
 .convertBodyTo(Document.class)
 .setHeader(Ftp_URI).xquery(
 concat('ftp://' +...some more xpaths into the
 inbound config doc...), String.class)
  .pollEnrich(/* whoops! this is referenced at route
 setup time, not route runtime... - it won't work */)
  .to(log:...);

 So the question, more generally, is is it possible to alter the route
 definition - at runtime? i.e. after the route/context are started?

 You sorted of hinted at this in that July-2009 posting when you said:

 2) You can always stop, modify and start a route in Camel at runtime.

 I don't see how that would work since I would likely be attempting to
 modify the route at runtime
 from a bean method in the route - or are you suggesting one route
 stops/modifies another route?

 So the way I see it is - I would create the ftp route with a bogus URI
 and option startScheduler=false,
 on the ftp endpoint, or autoStart=false on the route.  Then in
 *another* route - the configurer route,
 I guess, access the ftp route and reconfigure the endpoint with the
 real settings, then start it's poll scheduler (or start it's route).

 Something like that?  Any easier, more direct way?

 Thanks,


 Chris



 --
 Claus Ibsen
 -
 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.
 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


Re: Camel/JMS with Atomikos UserTransactionManager not consuming Messages

2013-04-03 Thread Christian Müller
I use the following configuration [1] (with ActiveMQ).

[1]
https://github.com/muellerc/camel-in-transaction/blob/master/src/test/resources/META-INF/spring/JmsAndJdbcXATransactionSampleWithAtomikosTest-context.xml

Best,
Christian



On Wed, Apr 3, 2013 at 4:31 PM, yxzhao yxz...@stonewain.com wrote:

 Hi All,

 We have an app using Camel to schedule jobs and Atomikos to manage
 transactions accessing IBM MQ queues and Oracle DB. Once a while message
 consuming routes stop consuming messages completely without indication of
 any abnormal conditions.

 Does anyone out there experience this or something similar?

 By the way, when Atomikos manages transactions, do camel routes have to
 specify transacted work explicitly or Atomikos can detect the units of work
 automatically based on route definitions?

 Thanks in advance for any help, hints or suggestions.







 --
 View this message in context:
 http://camel.465427.n5.nabble.com/Camel-JMS-with-Atomikos-UserTransactionManager-not-consuming-Messages-tp5730286.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



Re: CronSchedulePolicy with cxf endpoint

2013-04-03 Thread Christian Müller
I miss the routeStopTime configuration [1]. Otherwise the route is still
running. Do I miss something?

[1] http://camel.apache.org/cronscheduledroutepolicy.html

Best,
Christian


On Wed, Apr 3, 2013 at 8:51 AM, Richa rsinha2...@gmail.com wrote:

 My route looks like this:

 CronScheduledRoutePolicy cronScheduledRoutePolicy=new
 CronScheduledRoutePolicy();
 cronScheduledRoutePolicy.setRouteStartTime(0 0/3 * * * ?);

 from(some sftp location)
 .noAutoStartup()
 .routePolicy(cronScheduledRoutePolicy)
 .to(cxf location)



 --
 View this message in context:
 http://camel.465427.n5.nabble.com/CronSchedulePolicy-with-cxf-endpoint-tp5730206p5730254.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



Re: placeholder in from uri

2013-04-03 Thread Olivier Lamy
Ok for the nested properties.
But my other question concerns usage of property in from uri.
from uri={{productImport.uri.location}} /
Is that supported ? It looks the scheme is a minimum.



2013/4/3 Claus Ibsen claus.ib...@gmail.com:
 Hi

 You can use {{ }} in the .properties file then Camel will pick that up.

 Support for using nested Spring ${ } is being tracked by
 https://issues.apache.org/jira/browse/CAMEL-6233

 And added in upcoming releases.


 On Wed, Apr 3, 2013 at 1:50 PM, Olivier Lamy ol...@apache.org wrote:
 Hi,

 I'd like to be able to use something like:

 from uri={{productImport.uri.location}} /

 But I have issues with that.
 Exception:
 Caused by: org.apache.camel.NoSuchEndpointException: No endpoint could
 be found for: {{productImport.uri.location}}, please check your
 classpath contains the needed Camel component jar.

 more details available here: https://gist.github.com/olamy/5298824

 Is it possible to use a placeholder for the whole uri ?
 Or the scheme (sftp, etc) is a minimum requited ?

 Thanks
 --
 Olivier Lamy
 Ecetera: http://ecetera.com.au
 http://twitter.com/olamy | http://linkedin.com/in/olamy



 --
 Claus Ibsen
 -
 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



-- 
Olivier Lamy
Ecetera: http://ecetera.com.au
http://twitter.com/olamy | http://linkedin.com/in/olamy


Re: CronSchedulePolicy with cxf endpoint

2013-04-03 Thread Richa
We are stopping the route dynamically using a shutdown processor based on
some business conditions.
Basically, shutdown processor has the below code: 

exchange.getContext().stopRoute(RouteID,6,TimeUnit.MILLISECONDS);

This results in the following log statement on the console:
Graceful shutdown of route completed!



--
View this message in context: 
http://camel.465427.n5.nabble.com/CronSchedulePolicy-with-cxf-endpoint-tp5730206p5730304.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Camel-AMQP connection factory

2013-04-03 Thread Gnanaguru S
Hello,

I am trying to do a simple use case to test camel-amqp. Gladly activemq 5.8
has the support for AMQP. 

How can I specify the connection settings for connecting to ActiveMQ using
camel-amqp ?

Please find my route below, I think there should be a right way to configure
AMQP. 

  camelContext id=camel xmlns=http://camel.apache.org/schema/spring;
route
from uri=activemq1:queue:input /
to uri=activemq2:queue:outamqp /

/route
  /camelContext

bean id=activemq2
class=org.apache.activemq.camel.component.ActiveMQComponent
property name=brokerURL value=tcp://localhost:5672/
/bean

* bean id=activemq1
class=org.apache.activemq.camel.component.ActiveMQComponent
  property name=brokerURL value=tcp://localhost:61616/
/bean*

Regards
Guru
@gnanagurus



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


Re: placeholder in from uri

2013-04-03 Thread Claus Ibsen
Yes that is supported.

See this FAQ why you can't use springs ${ } directly
http://camel.apache.org/how-do-i-use-spring-property-placeholder-with-camel-xml.html

And I guess you have already seen some of the information on
http://camel.apache.org/using-propertyplaceholder.html

On Thu, Apr 4, 2013 at 12:04 AM, Olivier Lamy ol...@apache.org wrote:
 Ok for the nested properties.
 But my other question concerns usage of property in from uri.
 from uri={{productImport.uri.location}} /
 Is that supported ? It looks the scheme is a minimum.



 2013/4/3 Claus Ibsen claus.ib...@gmail.com:
 Hi

 You can use {{ }} in the .properties file then Camel will pick that up.

 Support for using nested Spring ${ } is being tracked by
 https://issues.apache.org/jira/browse/CAMEL-6233

 And added in upcoming releases.


 On Wed, Apr 3, 2013 at 1:50 PM, Olivier Lamy ol...@apache.org wrote:
 Hi,

 I'd like to be able to use something like:

 from uri={{productImport.uri.location}} /

 But I have issues with that.
 Exception:
 Caused by: org.apache.camel.NoSuchEndpointException: No endpoint could
 be found for: {{productImport.uri.location}}, please check your
 classpath contains the needed Camel component jar.

 more details available here: https://gist.github.com/olamy/5298824

 Is it possible to use a placeholder for the whole uri ?
 Or the scheme (sftp, etc) is a minimum requited ?

 Thanks
 --
 Olivier Lamy
 Ecetera: http://ecetera.com.au
 http://twitter.com/olamy | http://linkedin.com/in/olamy



 --
 Claus Ibsen
 -
 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



 --
 Olivier Lamy
 Ecetera: http://ecetera.com.au
 http://twitter.com/olamy | http://linkedin.com/in/olamy



-- 
Claus Ibsen
-
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


Delete files in SFTP, only when route completed successfully

2013-04-03 Thread sarfaraj
Hi,

I have a route with SFTP consumer.

I added delete=true in SFTP component. What happen now, if we got exception
in route still its deleting the file. I want to delete only when it success
not in Exception case..

Any idea please ?

/Sarfaraj



--
View this message in context: 
http://camel.465427.n5.nabble.com/Delete-files-in-SFTP-only-when-route-completed-successfully-tp5730295.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Problem with Camel Jpa Component and Container Managed Transaction

2013-04-03 Thread doxumd
Hi Claus 

Thanks for your quick reply. I've added dependencies to aries and now I have
a new issue :( 

[ Blueprint Extender: 1] BlueprintContainerImpl INFO  Bundle
RouteTest is waiting for dependencies
[(((!(org.apache.aries.jpa.proxy.factory=*))(osgi.unit.name=jpa-example-pu))(objectClass=javax.persistence.EntityManagerFactory))]


something similar to this 
link
http://mail-archives.apache.org/mod_mbox/aries-user/201201.mbox/%3c4f0fe64d.2050...@die-schneider.net%3E
  




--
View this message in context: 
http://camel.465427.n5.nabble.com/Problem-with-Camel-Jpa-Component-and-Container-Managed-Transaction-tp5714815p5730297.html
Sent from the Camel - Users mailing list archive at Nabble.com.