我跟着以下示例使用了一个不同的我使用的MS SQL数据库。 http://wso2.com/library/tutorials/2013/11/scheduled-database-polling-with-wso2-data-services-server/
我观察到轮询正在按预期工作但是时间戳(sql中的datetime列没有得到更新)
这是我的DSS XML
<data enableBatchRequests="true" name="PollingService" serviceNamespace="http://ws.wso2.org/dataservice/samples/eventing_sample" transports="http https local">
<config enableOData="false" id="Default">
<property name="driverClassName">com.microsoft.sqlserver.jdbc.SQLServerDriver</property>
<property name="url">jdbc:sqlserver://geoshieldsp3\sqlexpress;databaseName=RahulTest</property>
<property name="username">sa</property>
<property name="password">CSSL#2014</property>
</config>
<query id="pollingQuery" output-event-trigger="pollingTrigger" useConfig="Default">
<sql>select x.[Call Number], x.Priority, x.Call_Type, x.DispatchDate,y.total from CADFeeds as x left join 
(select *,count([Call Number]) over() as total from CADFeeds ) as y on x.[Call Number]=y.[Call Number] 
where x.DispatchDate > (select TIMESTAMP from Timestamp where id=1)</sql>
<result element="Calls" rowName="call">
<element column="Call Number" name="CallNumber" xsdType="string"/>
<element column="Priority" name="Priority" xsdType="float"/>
<element column="Call_Type" name="Call_Type" xsdType="string"/>
<element column="DispatchDate" name="DispatchDate" xsdType="string"/>
<element column="total" name="count" xsdType="integer"/>
</result>
</query>
<query id="UpdateTimeStamp" useConfig="Default">
<sql>update dbo.Timestamp set timestamp = GETDATE() where ID=1</sql>
<param name="timestamp" ordinal="2" sqlType="STRING"/>
</query>
<event-trigger id="pollingTrigger">
<expression>//*[local-name()='count' and namespace-uri()='http://ws.wso2.org/dataservice/samples/eventing_sample']>0</expression>
<target-topic>polling_Topic</target-topic>
<subscriptions>
<subscription>http://localhost:8280/services/PollingProxy</subscription>
</subscriptions>
</event-trigger>
<operation name="PollingOperation">
<call-query href="pollingQuery"/>
</operation>
<operation name="UpdateTimeStamp">
<call-query href="UpdateTimeStamp">
<with-param name="timestamp" query-param="timestamp"/>
</call-query>
</operation>
</data>
以下是时间戳表的数据库架构
CREATE TABLE [dbo].[Timestamp](
[ID] [int] NULL,
[timestamp] [datetime] NULL
)ON [PRIMARY]
我在日志或命令提示符中没有看到与时间戳更新有关的任何内容。
非常感谢任何帮助。
谢谢, 拉胡
答案 0 :(得分:0)
操作和查询之间似乎不匹配。
对于下面的SQL,不需要查询参数,因为没有提供参数。 请尝试以下方法。
<operation name="UpdateTimeStamp">
<call-query href="UpdateTimeStamp">
</call-query>
</operation>
<query id="UpdateTimeStamp" useConfig="Default">
<sql>update dbo.Timestamp set timestamp = GETDATE() where ID=1</sql>
</query>