0

Iam from Spain, forgive my English because Im not very at languages. Here is my question. Iam programming in ESPER-EPL. I want to detect 6 events since a specific date at 3 pm, but I dont know how to do it correctly. I know that I have to put a code any operator but I am starting to be crazy. Could you help me?

@Name("DetectoCambiosPares")
INSERT INTO DetectorPares
SELECT a1.systemNumber, a1.time,a1.events,
        a2.systemNumber, a2.time,a2.events,
        a3.systemNumber, a3.time,a3.events,
        a4.systemNumber, a4.time,a4.events,
        a5.systemNumber, a5.time,a5.events,
        a6.systemNumber, a6.time,a6.events
FROM PATTERN [every  (a1 = RankingProd()->
    a2 = RankingProd() ->
    a3 = RankingProd() -> timer:interval(2 hours)->
    a4 = RankingProd() ->
    a5 = RankingProd() ->
    a6 = RankingProd())
]
WHERE (a1.systemNumber = a4.systemNumber AND 
        a2.systemNumber=a5.systemNumber AND 
        a3.systemNumber=a6.systemNumber)!=TRUE;

1 Answers1

0

Is it 3pm each day or a given day?

And how long should the pattern remain active? Until 3pm the next day? Forever? Or until there is a match? How many patterns can be active at the same time if there was no match 3pm every day?

Here is a solution that starts the pattern 3pm the first day thereafter once:

create context From3PMEachDay start (0, 15, *, *, *);

context From3PMEachDay INSERT INTO DetectorPares
SELECT a1.systemNumber, a1.time,a1.events, ....
... the pattern here just like you have it...;

For a pattern that starts 3pm every day

create context From3PMEachDay initiated by (0, 15, *, *, *);
user650839
  • 2,594
  • 1
  • 13
  • 9