Can data source field in templater-options.json take a parameter (like $id) ?
-
We are using templater with RabbitMQ (AMQP messaging) with a python software.
This software take a message from the queue, and launch the shell script templater.ps1 with arguments.
We want to add an extra argument to this templater.ps1 which is the id to take from our API to render the right film.
Is this possible ?
Our message from rabbitMQ also give the json to use, is the data source field can take this local Json someway ?
-
@jonathan What you want to achieve is possible for sure, but you cannot pass the .json file an argument — it’s not a script, it’s a configuration file. However, you can absolutely have an app write to the templater-options.json file before calling the .ps1 file.
The software app you are building might do the following steps:
- Read new message from the RabbitMQ
- Write the new job’s re-versioning JSON data to a file.
- Write a new, or modify an existing, templater-options.json file, namely with the data_source property with the correct value. In your case, the data_source property should point to the file that contains the created re-versioning JSON file that was created in step 2.
- Launch the .ps1 file in the same directory as the newly written templater-options.json file.
Does this help?
Thanks,
Arie -
Hi, thanks for your answer.
We try to not update nor rewrite templater-options.json file. It’s too much for one field. But we can do the contrary :
We gonna try to rewrite a file named data.json with the current data source from rabbitMQ and point our templater-options.json data source field to it.Is it gonna work ?
-
It should work, yes. Keep in mind that when you use the CLI, it’s essentially a synchronous process because you cannot execute more than one AE instance at any given time. If that is not an issue, then it will work perfectly.
However if you plan on having concurrent CLI calls, then you might consider using the CLI to “Enable Bot” and have Bot “watch” the data source. If your data object contains a “render-status” property and it’s set to “ready” then Templater will process that job. In this way, you can have you app keep writing to the data.json file with new objects and then Templater will just pick them up.
There is another forum post that describes the different deployment techniques. Take a read through that one and see if it helps you understand the broader methods for architecting your solution.
Thanks,
Arie