比较 CronExpression 和实际时间以了解是否执行

问题描述

我想通过一个 esb 任务中的“Cron 表达式”配置,以一般方式调用多个 sql Server 存储过程。

我不想为一个存储过程创建一个任务,但每个存储过程都有不同的“Cron 表达式”。

例如,我有一张桌子

CONfigURATION
CronExpression          |Procedure   |Description
--------------------------------------------------------------
0 0/5 * * * ?           |Proc1       |every 5 minutes
10 0/5 * * * ?          |Proc2       |every 5 minutes,at 10 seconds after the minute (i.e. 10:00:10 am,10:05:10 am,etc.)
0 30 10-13 ? * WED,FRI  |Proc3       |10:30,11:30,12:30,and 13:30,on every Wednesday and Friday

我只想创建一个任务,例如:每分钟OnlyOneTask.xml

<?xml version="1.0" encoding="UTF-8"?>
<task xmlns="http://ws.apache.org/ns/synapse"
      name="OnlyOneTask"
      class="org.apache.synapse.startup.tasks.MessageInjector"
      group="synapse.simple.quartz">
   <trigger cron="0 0/1 * 1/1 * ? *"/>
   <property xmlns:task="http://www.wso2.org/products/wso2commons/tasks"
             name="injectTo"
             value="sequence"/>
   <property xmlns:task="http://www.wso2.org/products/wso2commons/tasks"
             name="sequenceName"
             value="OnlyOnesequence"/>
   <property xmlns:task="http://www.wso2.org/products/wso2commons/tasks" name="message">
      <getQuote xmlns=""/>
   </property>
</task>

只有一个序列:OnlyOnesequence.xml

在序列的开头,我将 CONfigURATION 数据放入 JSON,然后我有

...
    <iterate continueParent="true" expression="//configuration" sequential="true">
        <target>
           <sequence>
                <property name="CronExpression" expression="//configuration/CronExpression"/>
                <property name="Procedure" expression="//configuration/Procedure"/>
                    <filter ?????????>   <!--  Here I wanna compare CronExpression and actual time for to kNown if to exec or not  -->
                    <then>
                        <dbreport>
                            <connection>
                                <pool>
                                    <dsName>DataBaseName</dsName>
                                </pool>
                            </connection>
                            <statement>
                                <sql>EXEC (?)</sql>
                                <parameter expression="get-property('Procedure')" type="VARCHAR"/>
                            </statement>
                        </dbreport>
                    </then>
                </filter>
                
            </sequence>
        </target>
     </iterate>
...

我可以在“?????????”的过滤器内部做什么?

谢谢。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)