0

I tried the OpenLiberty MP Config Sample (guide-microprofile-config), so far it works. But when analyzing it more closely, I found out that the method getProperties() in the file CustomConfigSource is called several times in repetition. This is a behavior I did not expect. In the file InventoryConfig there are variables injected statically and dynamically (by using "Provider<>"). But this code should only be called when I call a REST Service. So my question what does trigger getProperties() all the times? How can I prevent it. Actually with my implementation I want to access a database and do a query and I wanted to put the logic into getProperties() which now it seems a bad idea.

best regards Igor

Igor
  • 41
  • 5

2 Answers2

1

In OpenLiberty, user provided ConfigSources are dynamic and so the system re-reads them regularly. The default refresh interval can be adjusted by setting a System Property called microprofile.config.refresh.rate. The value is in milliseconds. If you set it to zero then it won't refesh at all. For further information, see here (look for the section titled "Dynamic property values"):

https://www.ibm.com/support/knowledgecenter/en/SSEQTP_liberty/com.ibm.websphere.wlp.doc/ae/cwlp_microprofile_overview.html

If you would like to comment on or contribute to future MicroProfile Config versions, please get involved at https://github.com/eclipse/microprofile-config/

Tom Evans
  • 61
  • 1
1

By the way, the above described behavior is Open Liberty implementation detail. The current MicroProfile Config specification does not mandate a way to deal with Dynamic config sources. The upcoming MicroProfile Config release will address this area.

Emily Jiang
  • 151
  • 3
  • Hi Emily, thank you for your valuable answer, I'm looking forward to get the newest MicroProfile Config Release and I will surely use it with Open Liberty. The dynamic config feature will help me a lot with the use cases we actually have at the moment. – Igor Sep 18 '18 at 18:51