Check MQTT Message exist in "File"

Maybe an overkill for your situation... In my use case see Use of NodeRed for international weather, climate, ocean, hydrology data exchange I am using redis to do this kind of check. We use the payload j3hh432j as a key in redis. Through redis get/set it is fairly easy to do this. Obviously, you'll need a redis instance (typically a docker version of it will do) for this to work.

As Colin wrote, an array in a persistent context is simpler than "grepping" into a file...