Skip to content

Enriching messages with local static data #2374

Answered by mihaitodor
lawrencejob asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @lawrencejob 👋 Assuming that the "medium-sized JSON file" you have easily fits in memory in its entirety, then you can use a mapping processor where you have something like let toc_colors = file(path:"path_to_the_json_file", no_cache:false).parse_json(). If the file can change in time, you can set no_cache:true, but that will be slow since it will read the file each time this processor is invoked. There are workarounds if you need to cache it for a certain period of time, like using an in-memory cache with some ttl. There's also file_rel() if you wish to keep this mapping along with the json file in some separate folder.

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@lawrencejob
Comment options

@mihaitodor
Comment options

Answer selected by lawrencejob
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants