나는 Cumulocity에서 쓴 몇 가지 규칙을 테스트 중이었고, 원하는 결과를 얻을 수 없었으므로 비교를 위해 Esper EPL online tool을 사용해 보았습니다. 내가 설명 할 수없는 두 가지 결과물의 차이점을 발견했다.cumulocity epr와 esper의 차이
기본적으로 소스로 분할되고 "시작"및 "중지"이벤트로 구분 된 컨텍스트를 만듭니다. 내 상황이 끝나면 시작과 끝 이벤트에서 세부 정보 (유형과 시간) 만 표시하고 싶습니다. (그 순간의 이벤트는 신경 쓰지 않습니다.) 여기
(그들은 이미 "기본적으로"정의되기 때문에 생성 스키마가 Cumulocity 제거 될 수있다) 내 규칙입니다 :create schema EventCreated(
source String,
type String,
time Date
);
create schema CreateMeasurement(
source String,
type String,
time Date,
fragments Object
);
@Name("create_context")
create context Trip
context bySource
partition by source from EventCreated,
context byEvents
start EventCreated(
type = "c8y_ObdConnectionReport" or
type = "c8y_PowerOnReport" or
type = "c8y_FixedReport" or
type = "c8y_HarshBehaviorReport") as startEvent
end EventCreated(
type = "c8y_ObdDisconnectionReport" or
type = "c8y_PowerOffReport" or
type = "c8y_SilentTracker") as endEvent;
@Name("context_end")
context Trip
insert into
CreateMeasurement
select
context.bySource.key1 as source,
"Trip" as type,
e.time as time,
{
"startedBy", context.byEvents.startEvent.type,
"startedAt", context.byEvents.startEvent.time,
"endedBy", e.type,
"endedAt", e.time
} as fragments
from
EventCreated e
output
last when terminated;
그리고 여기에 차이를 볼 수있는 간단한 이벤트 순서입니다 :
EventCreated = {
source = '1672192',
type = 'c8y_ObdConnectionReport',
time = '2016-10-07T10:00:00.000'
}
t = t.plus(5 minutes)
EventCreated = {
source = '1672192',
type = 'c8y_FixedReport',
time = '2016-10-07T10:05:00.000'
}
t = t.plus(5 minutes)
EventCreated = {
source = '1672192',
type = 'c8y_ObdDisconnectionReport',
time = '2016-10-07T10:10:00.000'
}
을
At: 2016-10-07 10:05:00.000
Statement: context_end
Insert
CreateMeasurement={
source='1672192',
type='Trip',
time='2016-10-07T10:05:00.000',
fragments[
'startedBy','c8y_ObdConnectionReport',
'startedAt','2016-10-07T10:00:00.000',
'endedBy','c8y_ObdDisconnectionReport',
'endedAt','2016-10-07T10:10:00.000']}
이 : 그래서 여기
는 EPL 온라인 시뮬레이터의를 사용하여 결과입니다 내가 원하는대로, 예상대로 첫 번째와 마지막 이벤트의 세부 정보를 얻었습니다.
{
"source":{
"id":"1672192",
"name":"Tracker 123456789000000",
"self":"http://tracker.post-iot.lu/inventory/managedObjects/1672192"},
"type":"Trip",
"time":"2016-10-25T11:56:46.983+02:00",
"self":"http://tracker.post-iot.lu/measurement/measurements/null",
"startedBy":"c8y_ObdConnectionReport",
"startedAt":"2016-10-25 11:56:44+0200",
"endedBy":"c8y_FixedReport",
"endedAt":"2016-10-25 11:56:46+0200"
}
(내가 Cumulocity와 실시간으로 일하고 있어요, 날짜를 무시) : 지금 이것은 내가 Cumulocity로 무엇을 얻을 수 있습니다. 보시다시피, 마지막 이벤트는 DisconnectionReport 대신 FixedReport로 간주됩니다. 그래서 Cumulocity에서 기본적으로 일어나는 일은 (다양한 상황을 시도했습니다) 때마다 컨텍스트의 종료 이벤트는 무시되고이므로 마지막에서 두 번째 이벤트 만 검색 할 수 있습니다.
위의 Esper 엔진과의 차이점은 무엇입니까? 어떻게 생각해야 할 것처럼이 일을 할 수 있습니까?
이제 시작 이벤트에서 동일한 문제가 발생합니다 (context.byEvents.startEvent를 사용할 때 두 번째 이벤트 만 검색 함). –