You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Deepak kumar <dk...@gmail.com> on 2017/01/23 10:30:44 UTC

camel quartz2 scheduler external quartz.properties file

We have a spring boot backed camel project and we are using a camel-quartz2
component . The problem is by default the quartz.properties file is expected
to be present in org.quartz directory inside the src/main/resources
directory . Is there any possible way where i can give the location of the
quartz.properties file as a jvm parameter when i start my project .
Something like --   -Dquartz= D://test//quartz.properties
Also i tried the "propertiesFile" config using spring bean , this also
didn't work for me. Any suggestions..

Regards,
Deepak 



--
View this message in context: http://camel.465427.n5.nabble.com/camel-quartz2-scheduler-external-quartz-properties-file-tp5793004.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel quartz2 scheduler external quartz.properties file

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Oh btw I forgot that camel-quartz2-starter has Spring Boot auto
configuration which allows to configure the component options in the
application.properites / yml file and as well from ENV overrides that
SB support. So you can maybe configure it from ENV with


    {
      "name": "camel.component.quartz2.properties-file",
      "type": "java.lang.String",
      "description": "File name of the properties to load from the classpath",
      "sourceType":
"org.apache.camel.component.quartz2.springboot.QuartzComponentConfiguration"
    },


camel.component.quartz2.properties-file=file:XXXX

On Mon, Jan 23, 2017 at 9:36 PM, Claus Ibsen <cl...@gmail.com> wrote:
> Hi
>
> You may need to name the bean quartz2 or what the name you use in your
> Camel routes, eg
>
> @Bean(nane = "quartz2")
>
> Spring Boot will use the method name as the component name by default,
> so you can also name it
>
> @Bean
> QuartzComponent quartz2() {
>  ...
> }
>
> but that would be a bit odd to do, so its likely better to use
> @Bean(name = "quartz2"), or it may be enough to do @Bean("quartz2")
>
>
> On Mon, Jan 23, 2017 at 7:44 PM, Deepak kumar <dk...@gmail.com> wrote:
>> Hi Claus,
>> I tried by making a QuartzComponent using java config. But this one is not
>> getting detected in my camel-quartz component.
>>
>>         @Bean
>>         //@Produce(uri="quartz2://myscheduler2?cron=0+0/2+0+?+*+MON-SAT")
>>         public QuartzComponent quartzComponent(){
>>                 System.out.println("QuartzComponent..");
>>                 QuartzComponent quartz=new QuartzComponent();
>>                 //quartz.setPropertiesFile("file:D://quartz.properties");
>>                 return quartz;
>>         }
>>
>>
>>
>>
>> --
>> View this message in context: http://camel.465427.n5.nabble.com/camel-quartz2-scheduler-external-quartz-properties-file-tp5793004p5793021.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



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

Re: camel quartz2 scheduler external quartz.properties file

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

You may need to name the bean quartz2 or what the name you use in your
Camel routes, eg

@Bean(nane = "quartz2")

Spring Boot will use the method name as the component name by default,
so you can also name it

@Bean
QuartzComponent quartz2() {
 ...
}

but that would be a bit odd to do, so its likely better to use
@Bean(name = "quartz2"), or it may be enough to do @Bean("quartz2")


On Mon, Jan 23, 2017 at 7:44 PM, Deepak kumar <dk...@gmail.com> wrote:
> Hi Claus,
> I tried by making a QuartzComponent using java config. But this one is not
> getting detected in my camel-quartz component.
>
>         @Bean
>         //@Produce(uri="quartz2://myscheduler2?cron=0+0/2+0+?+*+MON-SAT")
>         public QuartzComponent quartzComponent(){
>                 System.out.println("QuartzComponent..");
>                 QuartzComponent quartz=new QuartzComponent();
>                 //quartz.setPropertiesFile("file:D://quartz.properties");
>                 return quartz;
>         }
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/camel-quartz2-scheduler-external-quartz-properties-file-tp5793004p5793021.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: camel quartz2 scheduler external quartz.properties file

Posted by Deepak kumar <dk...@gmail.com>.
Hi Claus,
I tried by making a QuartzComponent using java config. But this one is not
getting detected in my camel-quartz component. 

        @Bean
	//@Produce(uri="quartz2://myscheduler2?cron=0+0/2+0+?+*+MON-SAT")
	public QuartzComponent quartzComponent(){
		System.out.println("QuartzComponent..");
		QuartzComponent quartz=new QuartzComponent();
		//quartz.setPropertiesFile("file:D://quartz.properties");
		return quartz;
	}
 



--
View this message in context: http://camel.465427.n5.nabble.com/camel-quartz2-scheduler-external-quartz-properties-file-tp5793004p5793021.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel quartz2 scheduler external quartz.properties file

Posted by Claus Ibsen <cl...@gmail.com>.
You cannot use JVM or ENV parameters, but you can configure the
propertiesFile with either file: or classpath: as prefix to load it
from either of those.

Its using Camel's ResourceLoader (Helper) so we could consider adding
support for specifying an ENV or JVM prefix so its using that, eg

propertiesFile=env:MY_PROP

We do have property placeholder
http://camel.apache.org/using-propertyplaceholder.html

However that don't afair apply to options on component level configure
spring-bean style. You would need to find a way if spring-boot /
<bean> offers that. Or with spring boot you can add a bit of java code
that creates the QuartzComponent with @Bean or @Produces (cant
remember the annotation) and then write the java code it takes to read
that JVM parameter to find the file location and configure this using
java code.

On Mon, Jan 23, 2017 at 11:30 AM, Deepak kumar <dk...@gmail.com> wrote:
> We have a spring boot backed camel project and we are using a camel-quartz2
> component . The problem is by default the quartz.properties file is expected
> to be present in org.quartz directory inside the src/main/resources
> directory . Is there any possible way where i can give the location of the
> quartz.properties file as a jvm parameter when i start my project .
> Something like --   -Dquartz= D://test//quartz.properties
> Also i tried the "propertiesFile" config using spring bean , this also
> didn't work for me. Any suggestions..
>
> Regards,
> Deepak
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/camel-quartz2-scheduler-external-quartz-properties-file-tp5793004.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