You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Kevin-Void <an...@gmail.com> on 2017/05/09 12:10:10 UTC

Configuring Quartz in cfg file (Property placeholder)

Hello All,

I want to configure my quartz properties in cfg file or in an individual
property file in etc directory of the container, so that i can make changes
easily in that file instead of making change in code and rebuilding the jar
again.

Please find my code below:

my route:

<route id="allOffersRoute">           
    <from uri="quartz2://t3-newinventory-scheduler?cron={{cron.schedule}}"/>
    <log message="Got the message"/>
</route>

<bean id="quartz2"
class="org.apache.camel.component.quartz2.QuartzComponent">		
		<property name="propertiesFile" value="org/quartz/quartz.properties" />
	</bean>

quartz.properties file

# Main Quartz configuration
org.quartz.scheduler.skipUpdateCheck=true
org.quartz.scheduler.instanceName=DatabaseClusteredScheduler
org.quartz.scheduler.instanceId=AUTO
org.quartz.scheduler.jobFactory.class=org.quartz.simpl.SimpleJobFactory
org.quartz.jobStore.class=org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.oracle.OracleDelegate
org.quartz.jobStore.dataSource=quartzDataSource
org.quartz.jobStore.tablePrefix=QRTZ_
org.quartz.jobStore.isClustered=true
org.quartz.threadPool.class=org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount=10
org.quartz.jobStore.clusterCheckinInterval=20000


# JobStore: JDBC jobStoreTX
org.quartz.dataSource.quartzDataSource.driver=oracle.jdbc.driver.OracleDriver
org.quartz.dataSource.quartzDataSource.URL=jdbc:oracle:thin:@(DESCRIPTION =
(ADDRESS_LIST= (ADDRESS = (PROTOCOL = TCP)(HOST = *)(PORT =
1521)))(CONNECT_DATA =( SERVICE_NAME = *)))
org.quartz.dataSource.quartzDataSource.user=esb123
org.quartz.dataSource.quartzDataSource.password=esb123
org.quartz.dataSource.quartzDataSource.maxConnections=10
org.quartz.dataSource.quartzDataSource.validationQuery=select 0 from dual

I just want to configure the quartz.properties file externally so that i
dont have to change the jar everytime whenever there is a change is quartz
Database :( 

Please help.

Kind Regards,
Kevin




--
View this message in context: http://camel.465427.n5.nabble.com/Configuring-Quartz-in-cfg-file-Property-placeholder-tp5799160.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Configuring Quartz in cfg file (Property placeholder)

Posted by Kevin-Void <an...@gmail.com>.
Thanks Claus.

So we need to code as below manner. Kindly correct me if i am wrong.

<bean id="quartz2"
class="org.apache.camel.component.quartz2.QuartzComponent">                
                <property name="propertiesFile"
value="classpath:file:etc/quartz.properties" />
        </bean>

Kind Regards,
Kevin



--
View this message in context: http://camel.465427.n5.nabble.com/Configuring-Quartz-in-cfg-file-Property-placeholder-tp5799160p5800081.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Configuring Quartz in cfg file (Property placeholder)

Posted by Claus Ibsen <cl...@gmail.com>.
You can use classpath: as prefix to refer to the classpath. And file:
to refer to the file system. Then you can refer to the KARAF_HOME/etc
folder and the file name there.

On Wed, May 10, 2017 at 3:42 PM, Kevin-Void <an...@gmail.com> wrote:
> Yes Claus.. Is there a way to use quartz.properties file externally like cfg
> file or properties file outside the jar :(
>
> Regards,
> Kevin
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Configuring-Quartz-in-cfg-file-Property-placeholder-tp5799160p5799232.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: Configuring Quartz in cfg file (Property placeholder)

Posted by Kevin-Void <an...@gmail.com>.
Yes Claus.. Is there a way to use quartz.properties file externally like cfg
file or properties file outside the jar :(

Regards,
Kevin



--
View this message in context: http://camel.465427.n5.nabble.com/Configuring-Quartz-in-cfg-file-Property-placeholder-tp5799160p5799232.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Configuring Quartz in cfg file (Property placeholder)

Posted by Claus Ibsen <cl...@gmail.com>.
Yeah but fuse fabric v1 is still OSGi based running in karaf containers.

On Tue, May 9, 2017 at 5:06 PM, Kevin-Void <an...@gmail.com> wrote:
> Thanks for the response Claus..
>
> Actually the module is deployed in fabric environment(Clustered). The module
> is deployed in 3 nodes with same jar and config file.
>
> Kind Regards,
> Kevin
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Configuring-Quartz-in-cfg-file-Property-placeholder-tp5799160p5799175.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: Configuring Quartz in cfg file (Property placeholder)

Posted by Kevin-Void <an...@gmail.com>.
Thanks for the response Claus..

Actually the module is deployed in fabric environment(Clustered). The module
is deployed in 3 nodes with same jar and config file.

Kind Regards,
Kevin



--
View this message in context: http://camel.465427.n5.nabble.com/Configuring-Quartz-in-cfg-file-Property-placeholder-tp5799160p5799175.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Configuring Quartz in cfg file (Property placeholder)

Posted by Claus Ibsen <cl...@gmail.com>.
Are you talking about an Apache Karaf container?

Then I think its not very easy as the etc folder is osgi config admin
thingy, and that works only for osgi stuff and when using blueprint
with their ${ } placeholders.

Not sure if we can make camel-quartz understand osgi config admin, and
then allow to refer to a pid, eg

  <property name="propertiesFile" value="config-admin:myPidNameHere" />

Where config-admin is a osgi resolver that does that config admin lookup.

Also not sure if we can cause any re-load strategies, eg if you change
the properties file, then that should trigger a reload of the entire
bundle with your camel app. That is something you can do with
blueprint and config admin. Which likely is better for that. So likely
we need that, and then that above to refer to that blueprint thing.



On Tue, May 9, 2017 at 2:10 PM, Kevin-Void <an...@gmail.com> wrote:
> Hello All,
>
> I want to configure my quartz properties in cfg file or in an individual
> property file in etc directory of the container, so that i can make changes
> easily in that file instead of making change in code and rebuilding the jar
> again.
>
> Please find my code below:
>
> my route:
>
> <route id="allOffersRoute">
>     <from uri="quartz2://t3-newinventory-scheduler?cron={{cron.schedule}}"/>
>     <log message="Got the message"/>
> </route>
>
> <bean id="quartz2"
> class="org.apache.camel.component.quartz2.QuartzComponent">
>                 <property name="propertiesFile" value="org/quartz/quartz.properties" />
>         </bean>
>
> quartz.properties file
>
> # Main Quartz configuration
> org.quartz.scheduler.skipUpdateCheck=true
> org.quartz.scheduler.instanceName=DatabaseClusteredScheduler
> org.quartz.scheduler.instanceId=AUTO
> org.quartz.scheduler.jobFactory.class=org.quartz.simpl.SimpleJobFactory
> org.quartz.jobStore.class=org.quartz.impl.jdbcjobstore.JobStoreTX
> org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.oracle.OracleDelegate
> org.quartz.jobStore.dataSource=quartzDataSource
> org.quartz.jobStore.tablePrefix=QRTZ_
> org.quartz.jobStore.isClustered=true
> org.quartz.threadPool.class=org.quartz.simpl.SimpleThreadPool
> org.quartz.threadPool.threadCount=10
> org.quartz.jobStore.clusterCheckinInterval=20000
>
>
> # JobStore: JDBC jobStoreTX
> org.quartz.dataSource.quartzDataSource.driver=oracle.jdbc.driver.OracleDriver
> org.quartz.dataSource.quartzDataSource.URL=jdbc:oracle:thin:@(DESCRIPTION =
> (ADDRESS_LIST= (ADDRESS = (PROTOCOL = TCP)(HOST = *)(PORT =
> 1521)))(CONNECT_DATA =( SERVICE_NAME = *)))
> org.quartz.dataSource.quartzDataSource.user=esb123
> org.quartz.dataSource.quartzDataSource.password=esb123
> org.quartz.dataSource.quartzDataSource.maxConnections=10
> org.quartz.dataSource.quartzDataSource.validationQuery=select 0 from dual
>
> I just want to configure the quartz.properties file externally so that i
> dont have to change the jar everytime whenever there is a change is quartz
> Database :(
>
> Please help.
>
> Kind Regards,
> Kevin
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Configuring-Quartz-in-cfg-file-Property-placeholder-tp5799160.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