Re: De-duplicate route file name?

2013-05-18 Thread Claus Ibsen
On Fri, May 17, 2013 at 1:03 PM, Peter Hilton pedro+ca...@lunatech.com wrote:
 On 17 May 2013, at 09:33, Claus Ibsen claus.ib...@gmail.com wrote:
 You can use the move option on the Camel file consumer, and then use a
 bean to calculate the file name. http://camel.apache.org/file2

 Claus, by the way, your comment let to an 'aha' moment - the kind that 
 Manning talk about :)

 Being new to Camel, I hadn't realised the implications of the documentation 
 for File Component’s 'move' property (the implication being that I can write 
 my own code to calculate the file name):

 move: Expression (such as File Language) used to dynamically set the 
 filename when moving it after processing.

 Note that a later sentence on the same page seems to contract that I can use 
 this to calculate the file name:

 The move and preMove options should be a directory name, which can be either 
 relative or absolute.


Ah yeah let me update the docs to make this more clear. Thanks for
spotting this.



 Anyway, your suggestion to use a bean prompted me to drill down (→ 
 http://camel.apache.org/expression → http://camel.apache.org/bean-language) 
 and realise that I can always implement an expression or predicate as a 
 method in my own bean class.


Yes any expression / predicate can just be a method on a bean. For the
predicate the returned value is evaluated as a boolean or a non empty
value will be considered true.

 For what it’s worth, I don’t yet see how I would discover that my bean must 
 have a 'calculateFileName' method - whether Camel will pick this method 
 because it's the only one, or whether it has to have that name, for example. 
 I’ll save that for another day.


Yeah if there is only one method then that's picked up. You can also
tell Camel the name of the method to use

move=bean:myBean.myMethod

The bean selection logic is covered in CiA book chapter 4, or you can
find some details on the camel bean wiki pages, somewhere.

 Thanks again,
 Peter




--
Claus Ibsen
-
www.camelone.org: The open source integration conference.

Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cib...@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


Re: I want to call CamelContext.addRouteDefinition, but it's deprecated - how do I get ModelCamelContext?

2013-05-18 Thread Claus Ibsen
Hi

Yeah its IMHO a bit unfortunate with the @deprecated on the
CamelContext. But the point was to use ModelCamelContext as this
interface is from the model package. Where as CamelContext is from the
root.
So with the ModelCamelContext you dont have root - model in the
dependency triage.




On Fri, May 17, 2013 at 10:08 PM, Chris Wolf cwolf.a...@gmail.com wrote:
 In a custom Processor, I am calling CamelContext.addRouteDefinition -
 but the javadoc says it's deprecated and
 to use org.apache.camel.model.ModelCamelContex.addRouteDefinition(..) instead.

 I see that DefaultCamelContext implements ModelCamelContext, so I just
 cast it like:

 ModelCamelContext context = (ModelCamelContext)exchange.getContext();

 That seems to work too.  What is the difference between these two
 interfaces and the model
 sub-package, in general?  (I searched the FAQ and CiA book, but didn't
 find anything)

 Thanks,


 Chris



-- 
Claus Ibsen
-
www.camelone.org: The open source integration conference.

Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cib...@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


Re: How can I dynamically add or modify endpoints in a route?

2013-05-18 Thread Claus Ibsen
The RouteBuilder is just java code, so I suggest to add getter/setter
to a MyCronRouteBuilder class which extends RouteBuilder. Then you can
create a new instance of that, and then use the setter to set your
options.

And in the configure method you can use the getter to get your
options, which you can use in the DSL to set the options you want.

On Fri, May 17, 2013 at 6:53 PM, Chris Wolf cwolf.a...@gmail.com wrote:
 I need to schedule multiple cron jobs in a route.  The number and
 schedules are not known at compile-time,
 so I need to programatically configure the route at run-time.  An
 abbreviated version of my non-working
 attempt is shown below.  I created an anonymous RouteBuilder, in which
 I created a route.

 After, calling context.addRoutes(...), but before starting the
 context, I want to programmatically
 tweak the route definition, as shown by the reconfigure(...)
 function, unfortunately any attempt
 to lookup the route I just created fails - no routes found.  Why?  I
 suspect that the route may actually
 need to be started for it's initialization to complete, so should I
 start it, then stop or suspend, then
 programmatically modify?


 BTW, I already checked my copy of Camel In Action and
 http://camel.apache.org/faq.html but
 no answers for me there

 context.addRoutes(new RouteBuilder() {
   public void configure() {
 from(quartz://demo-1/{{custId}}?cron=* * * * * ? 2036).routeId(sched)
 .process(new Processor() {
   @Override
   public void process(Exchange exchange) throws Exception {
 // Do something at cron trigger time
   }
 }).id(sched.pipline)
 .to(log:demo-1?showAll=truemultiline=truelevel=INFO);
   }
 });

 reconfigure(sched.pipline, context);

 void reconfigure(String downstreamNodeId, CamelContext context) {
 for (Route route : context.getRoutes()) { // getRoutes()
 returns zero-length list - why
 String id = route.getId();  // null - why???
 ListService svcs = route.getServices();
 Consumer c = route.getConsumer();
 }
 Route sched = context.getRoute(sched);  // null



-- 
Claus Ibsen
-
www.camelone.org: The open source integration conference.

Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cib...@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


Re: Future of Fuse IDE

2013-05-18 Thread Christian Schneider

Hi Rob,

thanks for the link this might be interesting for many people. The only 
thing I am missing is a license statement.

I might have overlooked it but I did not find any license file in the tree.

Christian

Am 17.05.2013 20:48, schrieb Robert Davies:

Hi Mrinal - the src is here : https://github.com/fusesource/fuseide

On 17 May 2013, at 19:43, Mrinal Kanti mrinal_ka...@yahoo.com wrote:


Can someone send me a link to the open source version. I am unable to locate it 
on the Fusesource or Redhat website. Seems to me that the only version that is 
available is the enterprise trial one that too requires a redhat login with 
corporate account (no personal account).


Regards,
Mrinal





From: Preben.Asmussen p...@dr.dk
To: users@camel.apache.org
Sent: Friday, May 17, 2013 11:58 PM
Subject: Re: Future of Fuse IDE


As far as I know Fuse Ide is and will continue to be open source, but might
be donated to Apache or Eclipse. This is to be decided later.
Correct me if i'm wrong.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Future-of-Fuse-IDE-tp5732773p5732778.html
Sent from the Camel - Users mailing list archive at Nabble.com.





--
 
Christian Schneider

http://www.liquid-reality.de

Open Source Architect
Talend Application Integration Division http://www.talend.com



Re: Future of Fuse IDE

2013-05-18 Thread Robert Davies
Hi Christian,

the licence should be Eclipse. We are still working on the best home for Fuse 
IDE - its part of the JBoss Developer Studio product - but it should have a 
release, lifecycle of its own as open source project.

thanks,

Rob
On 18 May 2013, at 15:29, Christian Schneider ch...@die-schneider.net wrote:

 Hi Rob,
 
 thanks for the link this might be interesting for many people. The only thing 
 I am missing is a license statement.
 I might have overlooked it but I did not find any license file in the tree.
 
 Christian
 
 Am 17.05.2013 20:48, schrieb Robert Davies:
 Hi Mrinal - the src is here : https://github.com/fusesource/fuseide
 
 On 17 May 2013, at 19:43, Mrinal Kanti mrinal_ka...@yahoo.com wrote:
 
 Can someone send me a link to the open source version. I am unable to 
 locate it on the Fusesource or Redhat website. Seems to me that the only 
 version that is available is the enterprise trial one that too requires a 
 redhat login with corporate account (no personal account).
 
 
 Regards,
 Mrinal
 
 
 
 
 From: Preben.Asmussen p...@dr.dk
 To: users@camel.apache.org
 Sent: Friday, May 17, 2013 11:58 PM
 Subject: Re: Future of Fuse IDE
 
 
 As far as I know Fuse Ide is and will continue to be open source, but might
 be donated to Apache or Eclipse. This is to be decided later.
 Correct me if i'm wrong.
 
 
 
 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Future-of-Fuse-IDE-tp5732773p5732778.html
 Sent from the Camel - Users mailing list archive at Nabble.com.
 
 
 
 
 -- 
 Christian Schneider
 http://www.liquid-reality.de
 
 Open Source Architect
 Talend Application Integration Division http://www.talend.com
 



Camel JacksonDataFormat configuration in Spring XML

2013-05-18 Thread mbhaya
Hi,

I am working on JSON marshalling/unmarshalling and need to exclude certain
POJO fields from marshalling.
I have referred to the following link:
   http://camel.apache.org/json.html

It says that JSON View needs to be used.

And after that we need to specify the following in the java file.

JacksonDataFormat ageViewFormat = new JacksonDataFormat(TestPojoView.class,
Views.Age.class);
from(direct:inPojoAgeView).marshal(ageViewFormat);

I want to specify the above configuration in spring xml file. I know that we
can specify the dataformats in the following way:
 json id=jack library=Jackson
unmarshalTypeName=org.apache.camel.component.jackson.TestPojo/
But  I want to configure the JSON view(JacksonDataFormat ageViewFormat = new
JacksonDataFormat(TestPojoView.class, Views.Age.class)) in the spring xml
itself.

Please let me know how to do that.





--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-JacksonDataFormat-configuration-in-Spring-XML-tp5732801.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: I want to call CamelContext.addRouteDefinition, but it's deprecated - how do I get ModelCamelContext?

2013-05-18 Thread Chris Wolf
So was (is) the root package supposed to be internal and model the
ideal external API?

I'm still not certain of the purpose of the model package

Thanks,


Chris

On Sat, May 18, 2013 at 3:33 AM, Claus Ibsen claus.ib...@gmail.com wrote:
 Hi

 Yeah its IMHO a bit unfortunate with the @deprecated on the
 CamelContext. But the point was to use ModelCamelContext as this
 interface is from the model package. Where as CamelContext is from the
 root.
 So with the ModelCamelContext you dont have root - model in the
 dependency triage.




 On Fri, May 17, 2013 at 10:08 PM, Chris Wolf cwolf.a...@gmail.com wrote:
 In a custom Processor, I am calling CamelContext.addRouteDefinition -
 but the javadoc says it's deprecated and
 to use org.apache.camel.model.ModelCamelContex.addRouteDefinition(..) 
 instead.

 I see that DefaultCamelContext implements ModelCamelContext, so I just
 cast it like:

 ModelCamelContext context = (ModelCamelContext)exchange.getContext();

 That seems to work too.  What is the difference between these two
 interfaces and the model
 sub-package, in general?  (I searched the FAQ and CiA book, but didn't
 find anything)

 Thanks,


 Chris



 --
 Claus Ibsen
 -
 www.camelone.org: The open source integration conference.

 Red Hat, Inc.
 FuseSource is now part of Red Hat
 Email: cib...@redhat.com
 Web: http://fusesource.com
 Twitter: davsclaus
 Blog: http://davsclaus.com
 Author of Camel in Action: http://www.manning.com/ibsen


Re: How can I dynamically add or modify endpoints in a route?

2013-05-18 Thread Chris Wolf
Actually, after further experimenting, my reconfgure worked, but
only after the
CamelContext was started.  So the implementation was to just have an initial
route consuming from a direct:, then, when an message comes in, I dynamically
create and add new routes, each headed by a unique instance of
quartz://, who's
name corresponds to the customer-id, so each customer has their own crontab.

Thanks,


Chris

On Sat, May 18, 2013 at 3:42 AM, Claus Ibsen claus.ib...@gmail.com wrote:
 The RouteBuilder is just java code, so I suggest to add getter/setter
 to a MyCronRouteBuilder class which extends RouteBuilder. Then you can
 create a new instance of that, and then use the setter to set your
 options.

 And in the configure method you can use the getter to get your
 options, which you can use in the DSL to set the options you want.

 On Fri, May 17, 2013 at 6:53 PM, Chris Wolf cwolf.a...@gmail.com wrote:
 I need to schedule multiple cron jobs in a route.  The number and
 schedules are not known at compile-time,
 so I need to programatically configure the route at run-time.  An
 abbreviated version of my non-working
 attempt is shown below.  I created an anonymous RouteBuilder, in which
 I created a route.

 After, calling context.addRoutes(...), but before starting the
 context, I want to programmatically
 tweak the route definition, as shown by the reconfigure(...)
 function, unfortunately any attempt
 to lookup the route I just created fails - no routes found.  Why?  I
 suspect that the route may actually
 need to be started for it's initialization to complete, so should I
 start it, then stop or suspend, then
 programmatically modify?


 BTW, I already checked my copy of Camel In Action and
 http://camel.apache.org/faq.html but
 no answers for me there

 context.addRoutes(new RouteBuilder() {
   public void configure() {
 from(quartz://demo-1/{{custId}}?cron=* * * * * ? 2036).routeId(sched)
 .process(new Processor() {
   @Override
   public void process(Exchange exchange) throws Exception {
 // Do something at cron trigger time
   }
 }).id(sched.pipline)
 .to(log:demo-1?showAll=truemultiline=truelevel=INFO);
   }
 });

 reconfigure(sched.pipline, context);

 void reconfigure(String downstreamNodeId, CamelContext context) {
 for (Route route : context.getRoutes()) { // getRoutes()
 returns zero-length list - why
 String id = route.getId();  // null - why???
 ListService svcs = route.getServices();
 Consumer c = route.getConsumer();
 }
 Route sched = context.getRoute(sched);  // null



 --
 Claus Ibsen
 -
 www.camelone.org: The open source integration conference.

 Red Hat, Inc.
 FuseSource is now part of Red Hat
 Email: cib...@redhat.com
 Web: http://fusesource.com
 Twitter: davsclaus
 Blog: http://davsclaus.com
 Author of Camel in Action: http://www.manning.com/ibsen


Disable CXF logging in Jboss Fuse

2013-05-18 Thread gsehgal1
Hello,
Is there a way to disable CXF LoggingIntercepter both IN and OUT inside
the FUSE container. We have enabled the camel-cxf feature as we are using
REST. Though it keeps priting out the payload to the console; which we don't
want. 


Any help would be appreciated.

Cheers!
Gaurav





--
View this message in context: 
http://camel.465427.n5.nabble.com/Disable-CXF-logging-in-Jboss-Fuse-tp5732807.html
Sent from the Camel - Users mailing list archive at Nabble.com.