Hi,
How to calculate one alarm strategy for each device or one alarm strategy for each type of IOT device。 My way is: 1. Use ListStateto store device state data for calculation -- Sent from: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/ |
Hi,
Could you elaborate a bit more what do you want to achieve. What have you tried so far? Could you share some code with us? What problems are you facing? From the vague description you provided you should be able to design it with e.g. KeyedProcessFunction[1] Best, Dawid [1] https://ci.apache.org/projects/flink/flink-docs-release-1.10/dev/stream/operators/process_function.html#the-keyedprocessfunction On 24/03/2020 03:57, yang xu wrote: > Hi, > How to calculate one alarm strategy for each device or one alarm strategy > for each type of IOT device。 > My way is: > 1. Use ListStateto store device state data for calculation > > > > -- > Sent from: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/ signature.asc (849 bytes) Download Attachment |
Hi Dawid
I use Flink to calculate IOT device alarms,My scenario is that each device has an independent alarm strategy,For example, I calculate that the temperature of 10 consecutive event data of a device is higher than 10 degrees。 I use: sourceStream.keyBy("deviceNo") .flatMap(new StateAlarmCalculationFunction())..... StateAlarmCalculationFunction extends RichFlatMapFunction StateAlarmCalculationFunction use ListState<DeviceState> deviceListState to store the device state. After each device data comes in, I load the deviceListState for calculation,But I don't think it's smart enough. Is there anything better -- Sent from: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/ |
Hi,
I think what you are doing makes sense in principal. Probably you don't want to store all the data until you have enough but compute only what's necessary on the fly. So e.g. for your example I would store only how many consecutive events with temperature higher than 10 you have seen so far. If you need access to timers you can also have a look at the KeyedProcessFunction[1] instead of FlatMap function. E.g. if you want to find only 10 consecutive events with temperature higher than 10 that happened within one hour. Best, Dawid [1] https://ci.apache.org/projects/flink/flink-docs-release-1.10/dev/stream/operators/process_function.html#process-function-low-level-operations On 25/03/2020 02:41, yang xu wrote: > Hi Dawid > I use Flink to calculate IOT device alarms,My scenario is that each device > has an independent alarm strategy,For example, I calculate that the > temperature of 10 consecutive event data of a device is higher than 10 > degrees。 > I use: > sourceStream.keyBy("deviceNo") > .flatMap(new StateAlarmCalculationFunction())..... > StateAlarmCalculationFunction extends RichFlatMapFunction > StateAlarmCalculationFunction use ListState<DeviceState> deviceListState to > store the device state. After each device data comes in, I load the > deviceListState for calculation,But I don't think it's smart enough. Is > there anything better > > > > -- > Sent from: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/ signature.asc (849 bytes) Download Attachment |
Thank you very much.
-- Sent from: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/ |
Free forum by Nabble | Edit this page |