0
我試圖用Esper運行一個簡單的測試(第14章,http://dl.e-book-free.com/2013/07/activiti_in_action.pdf)。該代碼非常簡單:Esper:EPL「選擇」失敗du驗證錯誤
public class EventLengthWindowTest {
public class LoanRequestEvent {
public int amount =2;
public LoanRequestEvent(int a){
amount += a;
}
}
private int sumAmount = 0;
@Test
public void testEventLengthWindow() {
Configuration configuration = new Configuration();
configuration.addEventType(LoanRequestEvent.class);
EPServiceProvider epService = EPServiceProviderManager.getDefaultProvider(configuration);
EPAdministrator admin = epService.getEPAdministrator();
EPStatement epStatement = admin.createEPL("select sum(amount) as sumAmount from LoanRequestEvent.win:length(2)");
...
}
我得到關於EPL部分的錯誤消息:
"select sum(amount) as sumAmount from LoanRequestEvent.win:length(2)"
它說:
com.espertech.esper.client.EPStatementException: Error starting statement: Failed to validate select-clause expression 'sum(amount)': Property named 'amount' is not valid in any stream [select sum(amount) as sumAmount from LoanRequestEvent.win:length(2)]
任何想法,爲什麼出現這種情況?
太好了,非常感謝! – KayJ 2014-10-17 07:40:05