vert-x3 / vertx-config

Vert.x Configuration Service
Apache License 2.0
54 stars 64 forks source link

Add capability to execute a function on each scan period execution #42

Closed StephenOTT closed 6 years ago

StephenOTT commented 6 years ago

The retriever.listen function is only called when a change is detected.

Would be great if we could add the ability to configure code to execute when the scan period executes.

cescoffier commented 6 years ago

Do you mean before or after the scan?

StephenOTT commented 6 years ago

In my case it was a before scan. The use case was loggin: I wanted to log every time a scan occurs

cescoffier commented 6 years ago

I have added:

@Fluent
ConfigRetriever setBeforeScanHandler(Handler<Void> function);
StephenOTT commented 6 years ago

@cescoffier if a After is possible, that would be good as well. Could see wanting to only log on successful pull of the data

cescoffier commented 6 years ago

@StephenOTT I've have also added:

ConfigRetriever setConfigurationProcessor(Function<JsonObject, JsonObject> processor);

The passed function is called after the scan and allow validating the configuration, or even update it.