作業 2:確定規則集在 REST 中是有用的
在 Rule Execution Server 主控台中檢視規則集,並且測試它。
關於這項作業
使用 OpenAPI,在 REST 中測試規則集。
程序
- 切換至「範例主控台」視景, 並在「範例伺服器」視圖中按一下 Rule Execution Server 主控台,來開啟 Rule Execution Server 主控台。 在指導教學剩餘的作業中,您將使用主控台。
- 使用 resAdmin 作為使用者名稱與密碼來登入。
- 按一下瀏覽器標籤。在「導覽器」窗格中,展開 RuleApp。
- 展開 /PreTradeChecksRuleApp/1.0,並按一下 PreTradeChecks/1.0。
- 在「規則集視圖」頁面中,按一下擷取 HTDS 說明檔。
- 在服務通訊協定類型欄位中選取 REST, 並選取 Open API - JSON 選項。
- 選取決策追蹤資訊選項,然後按一下測試。
- 依照下列文字所示,設定 customer 參數:
"customerParameter": { "name": "John Smith", "owner": "George Smith@IBM", "initialValue": 2000, "currentValue": 800, "sectorPosition": 800, "bankStockPosition": 800, "oilStockPosition": 800, "railStockPosition": 800, "bondPosition": 800, "futurPosition": 800, "stockPosition": 800, "currency": "EURO" }, - 依照下列文字所示,設定 order 參數:
"orderParameter": { "id": "string", "stock": "Company X", "amount": 90, "exchange": "Nouveau Marche", "currency": "EURO", "destination": "France", "action": "BUY", "securityType": "STOCK", "dateTime": "2004-02-14T19:44:14.000+0000", "sector": "OIL", "status": "PENDING", "reasons": "BAD_CLIENT" }, - 設定 TraceFilter 所說明的追蹤參數。 將 none 和 infoTotalRulesFired 參數設為 true。將其餘的追蹤參數設為 false。
- 按一下執行要求按鈕,並檢查伺服器回應區段:
{ "__decisionTrace__": { "totalRulesFired": 4 }, "__DecisionID__": "string", "reportParameter": { "id": "string", "stock": "Company X", "amount": 90, "exchange": "Nouveau Marche", "currency": "EURO", "destination": "France", "action": "BUY", "securityType": "STOCK", "dateTime": "2004-02-14T19:44:14.000+0000", "sector": "OIL", "status": "BLOCKED", "reasons": "BLACK_LIST_STOCKS" }}追蹤會顯示已執行四項規則。因 BlackListStocks,封鎖了訂單狀態。
下一步
相關工作:
相關資訊: