rhiot / rhiot

Rhiot main code repository
http://rhiot.io
Apache License 2.0
101 stars 24 forks source link

Implement threshold feature for pi4j/dio/spi component #258

Open gautric opened 9 years ago

gautric commented 9 years ago

we could implement for some device a threshold feature.

for example if TEMP >= 25 ºC, temp camel could start send alert to the external process

from("i2c://1/0x12?label=Temp&threshold=[>25]").to("amqp:queue:alerting.acme.temp")

hekonsek commented 9 years ago

Actually this can be implemented using Camel DSL filter:

from("i2c://1/0x12?label=Temp").filter().simple("${body} > 25").to("amqp:queue:alerting.acme.temp")

And you can use any expression language you want.

What do you think? Is there any additional value in adding filtering logic on the component level?

gautric commented 9 years ago

@hekonsek yep you are right,

but I am thinking about CPU consumption too ;-) we deploy camel route over small, tiny and low cost CPU.

hekonsek commented 9 years ago

Hmmm, but you have to read the value anyway to determine if it is too high or not. If so, then doing it on the Camel level won't consume much more CPU. But maybe I'm wrong :) .