Hi Zhifeng,
You could have your json file added to your API Gateway document cache policy so it would not need to be read from the file system each time. That would require a gateway extension override json file to persist this change to the API Gateway object across all of your DataPower appliances in the service. Another approach would use distributed variables which was introduced in DataPower 10.6.0.0. Using an xslt you could store the file with an expiration, and when you attempt to read the file from the distributed variable, if you don't get a response you can read it from the file system and save the json object back to the distributed variable. Your json file updates would be made live the first time you read the file from the file system. You could also set your context variables in the xslt, just know that in xslt the JSON will need to be converted to JSONx so you can XPath properly to get the values. Unfortunately, although you can use distributed variables from GatewayScript too, it does not have the expire argument on the set function which is why the xslt is the recommended approach for distributed variables.
Best Regards,
Steve Linn
------------------------------
Steve Linn
Senior Consulting I/T Specialist
IBM
------------------------------
Original Message:
Sent: Mon August 12, 2024 09:09 PM
From: Z Yu
Subject: Using catalog properties or UDP to manage catalog wide properties
I have a question how to manage catalog or domain wide properties which are shared by all APIs in the same domain.
Initially I tried to use the catalog properties and set-variable policy so that these properties become context variables for each API. But I read the note from IBM APIC Documentation that if the catalog property changes we have to re-publish each API.
Then I decided to develop a UDP which reads key value pairs from a json file and sets these properties as context variables. This UDP is used by all APIs which depend on these properties. If there is a requirement to change the properties we can simply update the json file without re-publishing each API. But I am concerned now with the potential performance impact. With this UDP approach, in run time does each incoming request trigger the process of reading the file and loading properties into the context? These properties are constants and do not change most time.
Is there any better way to manage the domain or catalog wide properties which can be accessed by each API and properties can get updated without requiring each API?
------------------------------
Zhifeng Yu
Auburn Hills
------------------------------