Anypoint Studio Quartz端点轮询数据库



我找不到关于如何安排Quartz轮询DB中的表的真正教程。

我试着单独检查,但它在JDBC关联类端点上留下了"不推荐使用"的括号。

所以我有点迷路了。。。如何配置石英来调用Mule项目中创建的类,该类必须在每次调度程序超时时执行?

如何解析结果?

对不起,如果我要求很多东西,但我被卡住了。。。

编辑:

这是对全局连接器的尝试:

<?xml version="1.0" encoding="UTF-8"?> 
<mule xmlns:jdbc-ee="http://www.mulesoft.org/schema/mule/ee/jdbc"
    xmlns:db="http://www.mulesoft.org/schema/mule/db" xmlns:servlet="http://www.mulesoft.org/schema/mule/servlet"
    xmlns:quartz="http://www.mulesoft.org/schema/mule/quartz" xmlns="http://www.mulesoft.org/schema/mule/core"
    xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
    xmlns:spring="http://www.springframework.org/schema/beans" version="CE-3.5.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.mulesoft.org/schema/mule/ee/jdbc http://www.mulesoft.org/schema/mule/jdbc/current/mule-jdbc-ee.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/quartz http://www.mulesoft.org/schema/mule/quartz/current/mule-quartz.xsd
http://www.mulesoft.org/schema/mule/servlet http://www.mulesoft.org/schema/mule/servlet/current/mule-servlet.xsd
http://www.mulesoft.org/schema/mule/db http://www.mulesoft.org/schema/mule/db/current/mule-db.xsd">
    <db:oracle-config name="Oracle_Global_Connector"
        host="laaaaaaaaaaaaaaaaa.bbbbbbbbbb.yyyy.it" port="1521" instance="IEEEEE"
        user="HTTTTTTTTT" password="HHHHHHHHHH" doc:name="Oracle Configuration" />

    <jdbc-ee:connector name="Database_Global"
        dataSource-ref="Oracle_Global_Connector" validateConnections="true" queryTimeout="-1"
        pollingFrequency="0" doc:name="Database">
        <jdbc-ee:query key="RetriveQuery" value="select * from MyTable" />
    </jdbc-ee:connector>

    <quartz:connector name="AWB_Quartz_Poller"
        validateConnections="true" doc:name="Quartz">
        <quartz:factory-property key="org.quartz.scheduler.instanceName"
            value="MuleScheduler1" />
        <quartz:factory-property key="org.quartz.threadPool.class"
            value="org.quartz.simpl.SimpleThreadPool" />
        <quartz:factory-property key="org.quartz.threadPool.threadCount"
            value="3" />
        <quartz:factory-property key="org.quartz.scheduler.rmi.proxy"
            value="false" />
        <quartz:factory-property key="org.quartz.scheduler.rmi.export"
            value="false" />
        <quartz:factory-property key="org.quartz.jobStore.class"
            value="org.quartz.simpl.RAMJobStore" /> <!-- Optional -->
    </quartz:connector>

    <flow name="testquartzFlow1" doc:name="testquartzFlow1">
        <quartz:inbound-endpoint jobName="MyFirstQuartzScheduler"
            repeatInterval="10000" responseTimeout="10000" doc:name="QuartzInbound">
            <quartz:event-generator-job groupName="TestScheduler"
                jobGroupName="TestScheduler">
                <quartz:payload>This is a job scheduler that will write to file
                    after every 10 seconds.</quartz:payload>
            </quartz:event-generator-job>
        </quartz:inbound-endpoint>
        <jdbc-ee:outbound-endpoint exchange-pattern="request-response"
            queryKey="RetriveQuery" queryTimeout="-1" connector-ref="Database_Global"
            doc:name="Database (JDBC)" />
    </flow> 
</mule>

感谢

这里有一个使用石英的例子。。它将在每10秒后轮询一次数据库,并且不用担心"不推荐使用"的括号。。它将工作

  <spring:beans>
   <spring:bean id="DB_Source" name="DB_Source" class="org.enhydra.jdbc.standard.StandardDataSource">
      <spring:property name="url" value="Your DBURL"/>
      <spring:property name="driverName" value="Your Driver name"/>
    </spring:bean>
  </spring:beans>
  <jdbc-ee:connector name="Database_Global" dataSource-ref="DB_Source" validateConnections="true" queryTimeout="-1" pollingFrequency="0" doc:name="Database">
   <jdbc-ee:query key="RetriveQuery" value="Select * from TableName "/>
</jdbc-ee:connector>

<quartz:connector name="AWB_Quartz_Poller" validateConnections="true" doc:name="Quartz">
   <quartz:factory-property key="org.quartz.scheduler.instanceName" value="MuleScheduler1"/>
    <quartz:factory-property key="org.quartz.threadPool.class" value="org.quartz.simpl.SimpleThreadPool"/>
   <quartz:factory-property key="org.quartz.threadPool.threadCount" value="3"/>
   <quartz:factory-property key="org.quartz.scheduler.rmi.proxy" value="false"/>
    <quartz:factory-property key="org.quartz.scheduler.rmi.export" value="false"/>
    <quartz:factory-property key="org.quartz.jobStore.class" value="org.quartz.simpl.RAMJobStore"/> <!-- Optional -->
   </quartz:connector>

 <flow name="TestScheduleServiceFlow1" doc:name="TestScheduleServiceFlow1">
  <quartz:inbound-endpoint jobName="MyFirstQuartzScheduler" repeatInterval="10000" responseTimeout="10000" connector-ref="AWB_Quartz_Poller" doc:name="QuartzInbound">
 <quartz:event-generator-job groupName="TestScheduler" jobGroupName="TestScheduler">
  <quartz:payload>This is a job scheduler that will write to file after every 10 seconds.</quartz:payload>
 </quartz:event-generator-job>
 </quartz:inbound-endpoint>
 <jdbc-ee:outbound-endpoint exchange-pattern="request-response" queryKey="RetriveQuery" queryTimeout="-1" connector-ref="Database_Global" doc:name="Database (JDBC)"/>
 </flow>
 </mule>

相关内容

  • 没有找到相关文章

最新更新