Jagan Vittal
Jagan Vittal

Reputation: 98

Dynamic value for wso2 CEP window time

I am trying out WSO2 CEP for our new requirement. Currently i have written a query to find timedout events.

from InputStream#window.time(5 minutes) select * insert into TimeoutRequest for expired-events.

But my requirement is, the 5 minutes mentioned in time window will vary from each request. Some request should get timeout in 5 mins and some in 10 minutes. How to pass dynamic value for window.time(n minutes). If we can do via Custom Transformer or Custom Window, i am not getting the right context on how to do this.

Upvotes: 0

Views: 181

Answers (1)

Rajeev Sampath
Rajeev Sampath

Reputation: 2757

There can be different approaches to implement this:

  1. Custom window - you can write you own window (extending the time window) which looks for a specific attribute in events to determine their timeout durations.
  2. If there is only a limited set of time durations, you can simply define a window for each duration and point the incoming events to the relevant window using a filter. e.g:

    from InputStream[timeoutValue == 5]#window.time(5 minutes) select * insert into TimeoutRequest for expired-events

    from InputStream[timeoutValue == 10]#window.time(10 minutes) select * insert into TimeoutRequest for expired-events

Upvotes: 1

Related Questions