Search code examples
apache-camelquartz

Is quartz from camel 3 really the same thing as quartz2 from camel 2?


I am trying to upgrade camel from 2 to 3. I had previously had camel-quartz2 from camel 2 included in my pom.xml, but because quartz2 is apparently called quartz now, I have added this to my pom.xml:

<dependency>
  <groupId>org.apache.camel</groupId>
  <artifactId>camel-quartz</artifactId>
  <version>3.17.0</version>
</dependency>

I removed quartz2.

The problem is that I now receive this error.

Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'startDelayedSeconds' of bean class [org.apache.camel.component.quartz.QuartzComponent]: Bean property 'startDelayedSeconds' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?

I looked and saw that the the StartDelayedSeconds method is not part of quartz as it was with quartz2. Does this mean that they are really not the same? If this is the case, then why is the newest version of quartz2 so far behind the newest version of quartz. Is there some sort of workaround that I could do, or some part of quartz that I should use?


Solution

  • From the Came 3 migration guide:

    The quartz2 component has been renamed to quartz, and it’s corresponding component package from org.apache.camel.component.quartz2 to org.apache.camel.component.quartz. The supported scheme is now quartz.

    Source: https://camel.apache.org/manual/camel-3-migration-guide.html

    When I run command mvn dependency:tree with project that contains camel-quartz dependency I get the following:

    [INFO] +- org.apache.camel:camel-quartz:jar:3.4.4:compile
    [INFO] |  +- org.quartz-scheduler:quartz:jar:2.3.2:compile
    [INFO] |  |  +- com.mchange:mchange-commons-java:jar:0.2.15:compile
    [INFO] |  |  \- com.zaxxer:HikariCP-java7:jar:2.4.13:compile
    [INFO] |  \- com.mchange:c3p0:jar:0.9.5.5:compile
    

    Based on that I would say its safe to assume that camel-quartz in camel 3.x uses quartz scheduler version 2.x. The option StartDelayedSeconds has likely been moved or changed during one of the major or minor version changes.

    A lot of components have gone through some changes to use more up to date libraries and to make them easier to use or just consistent with other components.

    [Edit] Regarding the StartDelayedSeconds option found this from one of the many Apache Camel upgrade guides.

    UPGRADING CAMEL 3.14 TO 3.15 Removed the option startDelaySeconds as this does not work correctly and causes problems if in use.

    Source: Upgrading camel 3.14 TO 3.15