Domanda

Reading the Esper documentation I would like to make use of on-demand queries.

However, is it possible to create an on-demand query that runs for a certain amount of time?

Does Esper support this or would I need to write my own implementation, I know I should use prepared statements for repeated executions.

Esper Documentation: http://esper.codehaus.org/esper-4.0.0/doc/reference/en/html/api.html#api-runtime

È stato utile?

Soluzione

On on-demand query that runs for a certain amount of time would seem to be the same as a Esper continuous query. What is the point?

Altri suggerimenti

You can use a continuous query which only works at certain times. If you want an event to trigger only between to points in time, say only on the first of january between 10 and 11 am ,here's a way to do it:

select * from pattern [timer:at(0, 10:11, 1, 1,*) -> every MyEvent]

You can specify a time range with timer:at and use -> (followed by) to only make the event trigger inside a certain time range. The example above only works at the first first january between 10 and 11 after you specified it. So it's sort of a on-demand query. It assumes the event you're interested in is called MyEvent.

You can also use this approach for recurring time periods. For example, the following query allows MyEvent to trigger every monday during april:

select * from pattern [every timer:at(0, 0:23, *, 4, 1) -> every MyEvent]

Another way to do it would be using the Esper date-time methods. This allows for more control and more complicated queries, but you need your time information to come from the event itself (or from another one).

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top