I have a use case where i wanted to use MeasurementFragment as mentioned below
Step -1
monitor.subscribe(MeasurementFragment.SUBSCRIBE_CHANNEL);
on all MeasurementFragment(type=“Test1”,valueFragment=“Test1”)
as mf {
Output - will get the mf object or reference MeasurementFragment.
Note - I am not using the (valueSeries = “xyz”) here , as the valueSeries is not available currently .
Step -2 – Now i got the (valueSeries = “xyz”) value as xyz , can i use value series as filter or as criteria for above mf object or reference to get the value.
OK, We can do it in a couple of ways.
Case 1. if you are interested in both value-specific listeners (like type, fragment and series ) and other measurements. then you go with both filter bases and unmatched listeners.
Example:
on all MeasurementFragment(type="ABC", valueFragment ="XYZ", valueSeries ="DEF") as {
//do stuff
}
on all unmatched MeasurementFragment() {
log "Received unmatched measurements " at INFO.
//do stuff
}
Case 2: only interested in the value-specific listener and not bother with other measurements once it identified type, fragment and series value.
Listener l := on all MeasurementFragment() as mf {
// i.e : mf.type = “ABC” and mf.valueFragment = “XYZ” and mf.valueSeries = “DEF”
if (//get the measurement you want){
l.quit();
on all MeasurementFragment(type= mf.type, valueFragment=mf.fragment, valueSeries = mf.valueSeries) as matchingMF {
//do -stuff
}
}
}