下列範例指出您如何透過「主動式相互關聯技術」提供的變數來存取事件相關資訊。
act_event.getAttribute("hostname");
act_eventList.get(0);
<eventSelector alias="TECevent"> <eventType type="serverStatus"/> <filteringPredicate expressionLanguage="java"> return act_event.getStringAttribute("source").equals("TEC"); </filteringPredicate> </eventSelector> <eventSelector alias="WASevent"> <eventType type="serverStatus"/> <filteringPredicate expressionLanguage="java"> return act_event.getStringAttribute("source").equals("WAS"); </filteringPredicate> </eventSelector>下列程式碼顯示如何使用 act_eventList 變數,以取得第一個事件選擇器 (名為 TECevent) 已接受的事件:
act_eventList.get("TECevent");