2017-07-11 24 views
0

我跟隨下面的示例與一個不同的我使用MS SQL數據庫。 http://wso2.com/library/tutorials/2013/11/scheduled-database-polling-with-wso2-data-services-server/WSO2:數據庫輪詢教程時間戳不更新

我觀察到投票站工作正常,但時間戳(在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 &#xd;(select *,count([Call Number]) over() as total from CADFeeds) as y on x.[Call Number]=y.[Call Number] &#xd;where x.DispatchDate &gt; (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']&gt;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> 

這裏是DB模式的時間戳表

CREATE TABLE [dbo].[Timestamp](
[ID] [int] NULL, 
[timestamp] [datetime] NULL 

)ON [PRIMARY]

我在日誌或命令提示符中看不到與時間戳記更新相關的任何內容。

任何幫助,非常感謝。

感謝, 拉胡爾

回答

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> 
+0

我給你建議的修改和更新,以下 '<事件觸發ID = 「pollingTrigger」> // * [本地名稱()= '計數' 和namespace-uri()=「HTTP ://ws.wso2.org/dataservice/samples/eventing_sample'] polling_Topic http:// CSSLLAPTOP-168:8280 /服務/ PollingService '現在出現錯誤未找到操作的端點引用(EPR) – Rahul

+0

@Rahul您能否認罪se發佈在您的ESB中部署的代理服務xml? –

+0

我之前沒有創建代理服務,現在我創建了它,這是它的樣子' <日誌級別= 「滿」/> <日誌級別= 「滿」/>

' – Rahul