jamesnetherton commented on a change in pull request #3609: URL: https://github.com/apache/camel-quarkus/pull/3609#discussion_r824443141
########## File path: docs/modules/ROOT/pages/reference/extensions/quartz.adoc ########## @@ -38,3 +38,60 @@ Or add the coordinates to your existing project: ---- Check the xref:user-guide/index.adoc[User guide] for more information about writing Camel Quarkus applications. + +== Usage + +=== Clustering + +There are two options how to run Quartz in clustered mode: + +==== Quarkus based + +Follow the https://quarkus.io/guides/quartz[scheduling periodic tasks quartz guide]. + +- Define database configuration in `application.properties`. +- Use for example `flyway` to created database tables required for `Quartz`. + +===== Quartz based with an Agroal datasource + +Follow the http://www.quartz-scheduler.org/documentation/quartz-1.8.6/configuration/ConfigJDBCJobStoreClustering.html#configure-clustering-with-jdbc-jobstore[Configure Clustering with JDBC-JobStore Guide] with different DS configuration: + +- Use `quartz.properties` to configure `JobStore`. +- Define datasource via quarkus (see the https://quarkus.io/guides/datasource[Quarkus datasource documentation)] and use `CamelQuarkusQuartzConnectionProvider` as `ConnectionProvider` in `quartz.properties`: + +``` +... +org.quartz.jobStore.dataSource = myDS + +# datasource configuration +org.quartz.dataSource.myDS.connectionProvider.class = org.apache.camel.quarkus.component.quartz.CamelQuarkusQuartzConnectionProvider +org.quartz.dataSource.myDSB.dataSourceName = ds_name_if_not_set_default_ds_will_be_used +``` + + +- You can use for example `flyway` to created database tables required for `Quartz`. Review comment: ```suggestion - You can use for example `flyway` to create database tables required for `Quartz`. ``` ########## File path: extensions/quartz/deployment/src/main/java/org/apache/camel/quarkus/component/quartz/deployment/QuartzProcessor.java ########## @@ -44,4 +61,43 @@ NativeImageResourceBuildItem nativeImageResources() { ReflectiveClassBuildItem registerForReflection() { return new ReflectiveClassBuildItem(false, false, QUARTZ_JOB_CLASSES); } + + @BuildStep + ReflectiveClassBuildItem registerForReflectionWithMethods() { + return new ReflectiveClassBuildItem(true, false, QUARTZ_JOB_CLASSES_WITH_METHODS); + } + + @BuildStep + void registerForReflection(BuildProducer<ReflectiveClassBuildItem> reflectiveClasses, + CombinedIndexBuildItem combinedIndex, CurateOutcomeBuildItem curateOutcome) { + IndexView index = combinedIndex.getIndex(); + + ApplicationModel applicationModel = curateOutcome.getApplicationModel(); + boolean oracleBlobIsPresent = applicationModel.getDependencies().stream() + .anyMatch(d -> d.getGroupId().equals("com.oracle.database.jdbc")); + + final String[] delegatesImpl = index + .getAllKnownSubclasses(SQL_JDBC_DELEGATE) + .stream() + .map(c -> c.name().toString()) + .filter(n -> oracleBlobIsPresent || !n.contains("oracle")) + .toArray(String[]::new); + + reflectiveClasses.produce(new ReflectiveClassBuildItem(false, true, delegatesImpl)); + + } + + @BuildStep + void indexSaxonHe(BuildProducer<IndexDependencyBuildItem> deps) { + deps.produce(new IndexDependencyBuildItem("org.quartz-scheduler", "quartz")); + deps.produce(new IndexDependencyBuildItem("org.apache.camel.quarkus", "camel-quarkus-quartz")); Review comment: Do we need to index ourselves? ########## File path: docs/modules/ROOT/pages/reference/extensions/quartz.adoc ########## @@ -38,3 +38,60 @@ Or add the coordinates to your existing project: ---- Check the xref:user-guide/index.adoc[User guide] for more information about writing Camel Quarkus applications. + +== Usage + +=== Clustering + +There are two options how to run Quartz in clustered mode: + +==== Quarkus based + +Follow the https://quarkus.io/guides/quartz[scheduling periodic tasks quartz guide]. Review comment: I think we should make this the preferred configuration option given that it's more optimised. WDYT? ```suggestion This is the preferred option. Follow the https://quarkus.io/guides/quartz[scheduling periodic tasks quartz guide]. ``` ########## File path: docs/modules/ROOT/pages/reference/extensions/quartz.adoc ########## @@ -38,3 +38,60 @@ Or add the coordinates to your existing project: ---- Check the xref:user-guide/index.adoc[User guide] for more information about writing Camel Quarkus applications. + +== Usage + +=== Clustering + +There are two options how to run Quartz in clustered mode: + +==== Quarkus based + +Follow the https://quarkus.io/guides/quartz[scheduling periodic tasks quartz guide]. + +- Define database configuration in `application.properties`. +- Use for example `flyway` to created database tables required for `Quartz`. + +===== Quartz based with an Agroal datasource + +Follow the http://www.quartz-scheduler.org/documentation/quartz-1.8.6/configuration/ConfigJDBCJobStoreClustering.html#configure-clustering-with-jdbc-jobstore[Configure Clustering with JDBC-JobStore Guide] with different DS configuration: + +- Use `quartz.properties` to configure `JobStore`. +- Define datasource via quarkus (see the https://quarkus.io/guides/datasource[Quarkus datasource documentation)] and use `CamelQuarkusQuartzConnectionProvider` as `ConnectionProvider` in `quartz.properties`: + +``` +... +org.quartz.jobStore.dataSource = myDS + +# datasource configuration +org.quartz.dataSource.myDS.connectionProvider.class = org.apache.camel.quarkus.component.quartz.CamelQuarkusQuartzConnectionProvider +org.quartz.dataSource.myDSB.dataSourceName = ds_name_if_not_set_default_ds_will_be_used +``` + + +- You can use for example `flyway` to created database tables required for `Quartz`. + +===== Quartz based + +You can follow the http://www.quartz-scheduler.org/documentation/quartz-1.8.6/configuration/ConfigJDBCJobStoreClustering.html#configure-clustering-with-jdbc-jobstore[Configure Clustering with JDBC-JobStore Guide] without any modification: + +``` +... +org.quartz.jobStore.dataSource = myDS + +# datasource configuration +org.quartz.dataSource.myDS.driver = org.postgresql.Driver + +# datasource configuration +org.quartz.dataSource.myDS.URL=jdbc:postgresql://localhost:5432/default +org.quartz.dataSource.myDS.user = quarkus +org.quartz.dataSource.myDS.password = quarkus +``` + + +== Camel Quarkus limitations + +=== JDBC Job Store + +Quartz's property `org.quartz.jobStore.useProperties` is set to `true` and can not bet modified. Value is forced by Quarkus's extension. See the Quartz documentation for more information about `org.quartz.jobStore.useProperties`. Review comment: ```suggestion Quartz's property `org.quartz.jobStore.useProperties` is set to `true` and can not be modified. The value is forced by the Quarkus Quartz extension. See the Quartz documentation for more information about `org.quartz.jobStore.useProperties`. ``` ########## File path: pom.xml ########## @@ -72,6 +72,7 @@ <azure-core.version>1.21.0</azure-core.version><!-- @sync com.azure:azure-sdk-bom:${azure-sdk-bom.version} dep:com.azure:azure-core --> <azure-core-test.version>1.7.3</azure-core-test.version> <bouncycastle.version>1.70</bouncycastle.version><!-- @sync io.quarkus:quarkus-bom:${quarkus.version} dep:org.bouncycastle:bcprov-jdk15on --> + <c3p0.version>0.9.5.4</c3p0.version> Review comment: Maybe better to inherit the version from Camel. ```suggestion <c3p0.version>${3p0-version}</c3p0.version> ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org