我对m子很陌生。所以请问我一些基本的问题。我尝试搜索,但是找不到正确的线程来完全解决此问题,因此我已经花了数小时的时间。
这是我要实现的目标-在Mule流中,从MYSQL数据库中轮询一个名为Items的表,并仅获取那些以前未读取的行。我要以此为基础的数据库列是LastModifiedDate。 所以本质上 1)对于第一次民意测验,我需要做一些类似的事情,从Item中选择* * LastModifiedDate> now(); 2)对于后续的民意调查,应从LastModifiedDate> <>
的项目中选择*我在AnypointStudio 6.5上的Mule 3.9中使用水印进行了尝试 这是我的无效代码。
代码:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:dw="http://www.mulesoft.org/schema/mule/ee/dw" xmlns:metadata="http://www.mulesoft.org/schema/mule/metadata" xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns:db="http://www.mulesoft.org/schema/mule/db" xmlns:jms="http://www.mulesoft.org/schema/mule/jms" 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"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="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/db http://www.mulesoft.org/schema/mule/db/current/mule-db.xsd
http://www.mulesoft.org/schema/mule/jms http://www.mulesoft.org/schema/mule/jms/current/mule-jms.xsd
http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd
http://www.mulesoft.org/schema/mule/ee/dw http://www.mulesoft.org/schema/mule/ee/dw/current/dw.xsd">
<db:mysql-config name="AWS_RDS_MySQL_Configuration" host="awsdbinstance.cekg4jq5p8rn.us-east-1.rds.amazonaws.com" port="3306" user="sridhar" password="sridhar123" database="sample" doc:name="MySQL Configuration"/>
<jms:activemq-connector name="Active_MQ" username="admin" password="admin" brokerURL="tcp://localhost:61616" validateConnections="true" doc:name="Active MQ"/>
<flow name="databasepollerjmsenqueueFlow" processingStrategy="synchronous">
<poll doc:name="Poll">
<fixed-frequency-scheduler frequency="10" timeUnit="SECONDS"/>
<watermark variable="timestamp" default-expression="#[server.dateTime.format("yyyy-MM-dd HH:mm:ss")]" selector="MAX" selector-expression="#[payload.LastModifiedDate]"/>
<db:select config-ref="AWS_RDS_MySQL_Configuration" doc:name="Database">
<db:parameterized-query><![CDATA[select * from Item where LastModifiedDate > #[flowVars.timestamp.format("yyyy-MM-dd HH:mm:ss")]]]></db:parameterized-query>
</db:select>
</poll>
<logger message="Item Created . Payload is ----> #[payload]" level="INFO" doc:name="Logger"/>
<foreach collection="#[payload]" doc:name="For Each">
<jms:outbound-endpoint queue="ItemQueue" connector-ref="Active_MQ" doc:name="JMS"/>
<logger message="A message is sent to JMS queue" level="INFO" doc:name="Logger"/>
</foreach>
</flow>
<flow name="databasepollerjmsdequeueFlow">
<jms:inbound-endpoint queue="ItemQueue" connector-ref="Active_MQ" doc:name="JMS"/>
<logger message="***************Reading message from JMS queue***********" level="INFO" doc:name="Logger"/>
</flow>
</mule>
这是我的出路:
INFO 2018-08-01 21:14:54,031 [pool-18-thread-1] org.mule.api.processor.LoggerMessageProcessor: Item Created . Payload is ----> []
WARN 2018-08-01 21:14:54,031 [pool-18-thread-1] org.mule.routing.ExpressionSplitter: Splitter returned no results. If this is not expected, please check your split expression
INFO 2018-08-01 21:14:54,031 [pool-18-thread-1] org.mule.transport.polling.watermark.Watermark: Watermark value will not be updated since poll processor returned no results
基本上,输出未选择任何记录,这意味着轮询所基于的查询不会产生任何记录。请帮忙。