2017-03-01 1 views
0

Esper를 핵심 CEP 엔진으로 사용하는 응용 프로그램을 실행하고 있습니다. 이전에 Esper 런타임에 등록한 이벤트 유형을 가져 오려고하면 UnsupportedOperationException이 발생합니다.런타임시 Esper 구성 객체에서 eventType을 가져 오는 방법

esperConfiguration.addEventType(streamName, fieldNames, fieldTypes); 

-------- 
//several lines later 
-------- 

String[] propertyNames = esperConfiguration.getEventType(streamName).getPropertyNames(); 

나는 다음과 같은 예외가 얻을 :

java.lang.UnsupportedOperationException: Obtaining an event type by name is only available at runtime 
     at com.espertech.esper.client.Configuration.getEventType(Configuration.java:905) 

내가, 내 API 호출이 "런타임에"없는 이유를 이해 할 수없는 생각을 내가 초기화에 사용되는 것과 동일한 개체를 재사용하고 경우에도 Esper 엔진.

답변

1

EventType 개체는 초기화 된 엔진에서 사용할 수 있습니다. 따라서 예 :

esperConfiguration.addEventType(streamName, fieldNames, fieldTypes); 

EPServiceProvider epService = EPServiceProviderManager.getDefaultProvider(esperConfiguration); 

String[] propertyNames = epService.getEPAdministrator().getConfiguration().getEventType(streamName).getPropertyNames();