<ruleset xmlns="http://windup.jboss.org/schema/jboss-ruleset" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="spring-boot-to-azure-schedule-job" xsi:schemaLocation="http://windup.jboss.org/schema/jboss-ruleset http://windup.jboss.org/schema/jboss-ruleset/windup-jboss-ruleset.xsd">
    <metadata>
        <description>
            Determine whether application relies on scheduled jobs.
        </description>
        <dependencies>
            <addon id="org.jboss.windup.rules,windup-rules-xml,3.0.0.Final"/>
        </dependencies>
        <sourceTechnology id="springboot"/>
        <targetTechnology id="azure-appservice"/>
        <tag>scheduler</tag>
        <tag>quartz</tag>
    </metadata>
    <rules>
        <rule id="spring-boot-to-azure-schedule-job-01000">
            <when>
                <or>
                    <project>
                        <artifact artifactId="{*}" groupId="org.quartz-scheduler"/>
                    </project>
                    <project>
                        <artifact artifactId="spring-boot-starter-quartz" groupId="org.springframework.boot"/>
                    </project>
                </or>
            </when>
            <perform>
                <hint category-id="mandatory" effort="7" title="The application uses Quartz to scheduled jobs">
                    <message><![CDATA[
                        Scheduled jobs, such as Quartz Scheduler tasks or cron jobs, can't be used with App Service.
                        App Service won't prevent you from deploying an application containing scheduled tasks internally.
                        However, if your application is scaled out, the same scheduled job may run more than once per scheduled period.
                        This situation can lead to unintended consequences.

                        Inventory any scheduled jobs, inside or outside the application process.
                        ]]></message>
                    <link href="https://docs.microsoft.com/azure/developer/java/migration/migrate-spring-boot-to-app-service#determine-whether-application-relies-on-scheduled-jobs" title="The application uses Quartz to scheduled jobs"/>
                    <tag>quartz</tag>
                </hint>
            </perform>
        </rule>
    </rules>
</ruleset>
