@@ -447,6 +447,19 @@ export its main entry point symbol, configure mqttwarn to use `functions = myclo
447447and adjust its settings to use your MQTT broker endpoint at the beginning of the data
448448pipeline, invoke mqttwarn, and turn off Kafka. It works!
449449
450+ On the next day, after investigating if you need to migrate any other system components,
451+ you realize that there is an Nginx instance, which receives a certain share of telemetry
452+ traffic using HTTP, and processes it using Lua. One quick ` mosquitto_pub ` later, you are
453+ sure those telemetry messages are _ also_ available on the MQTT bus already. Another set
454+ of transformation rules written in Lua was quickly identified, and, after applying the
455+ same procedure of inlining it into a single-file version, and configuring another mqttwarn
456+ instance with ` functions = mycloud.lua ` , you are ready to turn off your whole cloud
457+ infrastructure, and save valuable resources.
458+
459+ After a while, you are able to hire back half of your previous engineering team, and,
460+ based on the new architecture, you will happily start contributing back to mqttwarn,
461+ both in terms of maintenance, and by adding new features.
462+
450463:::{note}
451464Rest assured we are overexaggerating a bit, and [ Kafka] can only be compared to [ MQTT]
452465if you are also willing to compare apples with oranges, but you will get the point that
@@ -467,6 +480,15 @@ available [OCI images](#using-oci-image).
467480You can find an example implementation for a ` filter ` function written in JavaScript
468481at the [ OwnTracks-to-ntfy example tutorial] ( #owntracks-ntfy-variants-udf ) .
469482
483+ #### Lua
484+
485+ For running user-defined functions code written in Lua, mqttwarn uses the excellent
486+ [ lupa] package. For adding JavaScript support to mqttwarn, install it using pip like
487+ ` pip install --upgrade 'mqttwarn[lua]' ` , or use one of the available
488+ [ OCI images] ( #using-oci-image ) .
489+
490+ You can find an example implementation for a ` filter ` function written in Lua
491+ at the [ OwnTracks-to-ntfy example tutorial] ( #owntracks-ntfy-variants-udf ) .
470492
471493
472494## User-defined function examples
@@ -707,6 +729,7 @@ weather,topic=tasmota/temp/ds/1 temperature=19.7 1517525319000
707729[ Jinja2 templates ] : https://jinja.palletsprojects.com/templates/
708730[ JSPyBridge ] : https://pypi.org/project/javascript/
709731[ Kafka ] : https://en.wikipedia.org/wiki/Apache_Kafka
732+ [ lupa ] : https://github.com/scoder/lupa
710733[ MQTT ] : https://en.wikipedia.org/wiki/MQTT
711734[ Node.js ] : https://en.wikipedia.org/wiki/Node.js
712735[ OwnTracks ] : https://owntracks.org
0 commit comments