Git Product home page Git Product logo

Comments (7)

marcc-orange avatar marcc-orange commented on June 12, 2024

Esper CEP has several time and cron-like features in Patterns like timer:interval:

every timer:interval(10 min)

from fiware-cepheus.

macu39 avatar macu39 commented on June 12, 2024

Thanks, I didn't see it on the doc. But when I'm using that parameter I get the following error:
Caused by: com.espertech.esper.client.EPStatementSyntaxException: Incorrect syntax near ':' at line 1 column 185, please check the output rate clause [INSERT INTO Event SELECT idEvent as id, dFlag as dFlag, cast(current_timestamp() ,string) as Title, wFlag as wFlag, mFlag as mFlag, idEvent as idEvent FROM Pevent OUTPUT ALL EVERY timer:interval(1 min)]

Due to the output rate but don't know how to solve it.

My sentence is:
INSERT INTO Event SELECT idEvent as id, dFlag as dFlag, cast(current_timestamp() ,string) as Title, wFlag as wFlag, mFlag as mFlag, idEvent as idEvent FROM Pevent OUTPUT ALL EVERY timer:interval(1 min)

I want it to run it every 1 min and, when the cep broker notifies changes to. What should I do?

from fiware-cepheus.

marcc-orange avatar marcc-orange commented on June 12, 2024

You are mixing the syntax for output limiting and the syntax for Patterns.

Patterns cannot be applied to output expressions, they are used in the FROM clause:

SELECT Pevent.id, Pevent.attr1, Pevent.attr2 FROM pattern[every timer:interval(10 min)]

Please use SO with the esper tag for questions related the Esper language, you might get better answers.

from fiware-cepheus.

marcc-orange avatar marcc-orange commented on June 12, 2024

An additional note: generating events on a fixed interval to update NGSI entities seems like a bad idea.

CEP are made to react to events (and "smartly" limiting them as output), not generating new entities updates all the time...

from fiware-cepheus.

macu39 avatar macu39 commented on June 12, 2024

Thanks for the answer but I still don't get how to solve my problem. Let me explain it a bit more.
I have this cep config:

{
  "host":"http://localhost:1028",
  "in":[
    {
      "id":"A.*",
      "type":"Pevent",
      "isPattern":true,
      "providers":[
        "http://localhost:1027" //
      ],
      "attributes":[
         { "name":"idEvent", "type":"string" },
         { "name":"endDate", "type":"date" }
      ]
    }
  ],
  "out":[
    {
      "id":"A",
      "type":"Event",
      "brokers":[
        {
          "url":"http://localhost:1026" //orion
        }
      ],
      "attributes":[
         { "name":"expired", "type":"int" }
      ]
    }
  ],
  "statements":[
     "INSERT INTO Event SELECT idEvent as id, case when endDate<current_timestamp() then 1 else 0 end as expired FROM Pevent OUTPUT all"
  ]
}

This config when new entity is aded or modified in cepheus context broker, it notifies cepheus cep and cep calculates if the entity is expired or not and send the result to orion.This is working ok with no problem.

The problem now is that I need to recalculate the expired attribute one time per hour and i don't know if it is possible in cep cause I can't make it work.

from fiware-cepheus.

macu39 avatar macu39 commented on June 12, 2024

I did ask it on stack overflow to http://stackoverflow.com/questions/37466515/how-to-correctly-configure-cepheus-cep-to-recalculate-a-attribute-every-hour

from fiware-cepheus.

marcc-orange avatar marcc-orange commented on June 12, 2024

I just posted an answer http://stackoverflow.com/questions/37466515/how-to-correctly-configure-cepheus-cep-to-recalculate-a-attribute-every-hour/37477234#37477234

from fiware-cepheus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.