2017-03-27 1 views
0

私はEsper(CEP)のwin_extウィンドウの理解に助けが必要です。古い(最初の2)のイベントがまだ更新方法のポップアップなぜ私は非常にesper_ext timedが古いエントリを除外しない理由

をいただければ幸い私はしばらくの間、助けをこれで困惑してきた彼らは

public class MyCepTest { 

    public static void main(String...args) throws Exception{ 
     System.out.println("starting"); 
     MyCepTest ceptest = new MyCepTest(); 
     ceptest.execute(); 
     System.out.println("end"); 
    } 

    public void execute() throws Exception{ 
     Configuration config = new Configuration(); 
     config.addEventType(MyPojo.class);   
     EPServiceProvider epService = EPServiceProviderManager.getDefaultProvider(config); 
     EPAdministrator admin = epService.getEPAdministrator(); 

     EPStatement x1 = admin.createEPL(win); 
     EPStatement x2 = admin.createEPL(win2);   

     x1.setSubscriber(this); 
     x2.setSubscriber(this); 

     EPRuntime runtime = epService.getEPRuntime(); 

     ArrayList<MyPojo> staffToSendToCep = new ArrayList<MyPojo>(); 
     staffToSendToCep.add(new MyPojo(1, new Date(1490615719497L))); 
     staffToSendToCep.add(new MyPojo(2, new Date(1490615929497L))); 

     for(MyPojo pojo : staffToSendToCep){ 
      runtime.sendEvent(pojo);  
     } 
     Thread.sleep(500); 
     System.out.println("round 2...");//why two first Pojos are still found? Shouldn't ext_timed(pojoTime.time, 300 seconds) rule them out? 

     staffToSendToCep.add(new MyPojo(3, new Date(1490616949497L)));   

     for(MyPojo pojo : staffToSendToCep){ 
      runtime.sendEvent(pojo);  
     }   
    } 

    public void update(Map<String,Object> map){ 
     System.out.println(map); 
    } 

    public static String win = "create window fiveMinuteStuff.win:ext_timed(pojoTime.time, 300 seconds)(pojoId int, pojoTime java.util.Date)";  
    public static String win2 = "insert into fiveMinuteStuff select pojoId,pojoTime from MyPojo"; 
} 

class MyPojo{ 
    int pojoId; 
    Date pojoTime; 
    MyPojo(int pojoId, Date date){ 
     this.pojoId = pojoId; 
     this.pojoTime = date; 
    } 

    public int getPojoId(){ 
     return pojoId; 
    } 
    public Date getPojoTime(){ 
     return pojoTime; 
    } 

    public String toString(){ 
     return pojoId+"@"+pojoTime; 
    } 
} 

を「期限切れ」されていても思ったんだけど

答えて

0

ドキュメントの処理モデルを参照してください。 http://espertech.com/esper/release-6.0.1/esper-reference/html/processingmodel.html すべての受信インサートストリームイベントは、リスナーとサブスクライバに配信されます。あなたのウィンドウに関係なく。ウィンドウがクエリ内にある場合は、考慮するイベントのサブセットを定義し、集約、パターンマッチ、または反復に使用できるものを定義します。参照するには、 "select * from MyPojo"を試してください。 http://espertech.com/esper/release-6.0.1/esper-reference/html/api.html#api-controlling-time 通常、「外部時間ウィンドウ」が必要なときは、イベント時間がエンジン時間を駆動するようにします。

関連する問題