How to get device id from followed by Listener in EPL App

How to get the device id from the measurement received by the first listener to use in the followed by listener.
code snippet:

on all measurement(type ="TYPE") as first -> on measurement(source=first.source){}

I am getting error in this as first is not hasn’t been initialized.

In that case you should nest the listeners:

on all Measurement(type ="TYPE") as first {
  on Measurement(source=first.source){}
}

I am not sure if that works, because I want to find sequence of the measurement value that’s why I used followed by in the Lisners.

I think you have to be a bit clearer about what exactly you want to achieve. The snippet you shared does not mention that the second measurement should be of the same type but I suspect that is what you want? In that case both statements should have a filter condition on the type.

If you have measurements coming in like this
1 2 3 4

my example would execute the block of the innermost listener three times:

  • 1 & 2
  • 2 & 3
  • 3 & 4

For 1, the outer listener matches, which starts an instance of the inner listener. When 2 arrives, the outer listener matches again and another instance of the inner listener is started. The first instance of the inner listener matches as well and terminates afterwards. For 3, the outer listener matches again and a third instance of the inner listener is started. The second instance of the inner listener matches as well and terminates afterwards.

The behavior with the follow-by operator should be very similar though it can subtly vary depending e.g. on whether you do “on all A() → B()” or "on all (A() → B()).

there is some good documentation available for listeners here:
https://documentation.softwareag.com/pam/10.15.3/en/webhelp/pam-webhelp/index.html#page/pam-webhelp%2Fco-DevApaAppInEpl_defining_event_listeners.html%23

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.