在不使用显式的情况下提高KRL中的事件

时间:2012-02-27 22:38:44

标签: krl

我正在编写一个引发事件的应用程序,类似于Phil Windley personal data manager application的工作方式。但是,如果我尝试使用任何事件域而不是explicit,则事件不会传播。以下规则适用于explicit作为域,但不适用于driverreg

rule driver_info_submit {
    select when web pageview ".*"
    pre {
        driver_name = "Joe Driver";
        driver_phone = "111-555-1212";
        msg = <<
            Current driver info: #{ent:driver_name}, #{ent:driver_phone}
        >>;
    }
    notify("Started", msg);
    fired {
        raise explicit event new_driver_data with driver_name=driver_name and driver_phone=driver_phone;
    }
}

// Save driver name
rule save_driver_name {
    select when explicit new_driver_data
    pre {
        driver_name = event:param("driver_name") || ent:driver_name;
        driver_phone = event:param("driver_phone") || ent:driver_phone;
    }
    noop();
    always {
        set ent:driver_name driver_name;
        set ent:driver_phone driver_phone;
        raise explicit event driver_data_updated;
    }
}

rule driver_info_updated {
    select when explicit driver_data_updated
    {
        notify("Driver name", ent:driver_name);
        notify("Driver phone", ent:driver_phone);
    }
}

应用程序是否已部署似乎不成问题,因为我已经尝试过两种方式。我错过了什么?

1 个答案:

答案 0 :(得分:2)

在raise语句中只允许某些域作为域:

  • 显式
  • HTTP
  • 系统
  • 通知
  • 错误
  • PDS

将来可能会放松。

这在以下文档中有所介绍:https://kynetxdoc.atlassian.net/wiki/display/docs/Raising+Explicit+Events+in+the+Postlude (请注意,这是文档的临时主页)