Hivemq Data Hub !!hot!! -

// 3. Enrich payload payload.timestamp = context.getCurrentTime(); payload.clientId = context.clientId;

// 4. Apply threshold filter & republish to a new topic if high temp if (payload.temperature > 85) var newTopic = "alerts/high-temp"; context.publish(newTopic, payload, qos: 1 ); hivemq data hub

// 5. Forward original (or transformed) message to original topic return message; // Or return a modified message payload.clientId = context.clientId

function onMessage(context, message) payload.temperature > 150) context.log.error("Invalid temperature: " + payload.temperature); return null; // Drop invalid reading 85) var newTopic = "alerts/high-temp"