I played with that quite some time.
Will try to takle it in the next week.

LieGrue,
strub



> Am 06.04.2017 um 15:59 schrieb Romain Manni-Bucau <[email protected]>:
> 
> Hi guys,
> 
> I hit 2 blockers in our config API (i was using the proxy one on the
> snapshot):
> 
> 1. empty string are not supported and throw an exception (this one is easy
> to workaround using null but it forces to define default elsewhere than
> @ConfigProperty)
> 2. we don't have events when a value changes. In current impl we have a
> refresh period and it is easy to check if previous and new value are the
> same.
> 
> What do you think about solving 2?
> 
> Here how I see it:
> 
> 1. (api) we have a CDI event triggered when there is a change
> 
> public void myListener(@Observes ConfigurationChanged event) {
>    if (event.changes().contains("mykey")) {} // for plain @Inject
> @ConfigProperty
>    if (event.getSource() == myConfigProxy) {} // for @Configuration case
> it is easier to filter this way
> }
> 
> 2. (impl) for the case of @Configuration it would certainly be saner to
> reload the whole config entries before the event is fired to kind of batch
> the changes (if you think about a datasource config you dont want to
> recreate your datasource for the username, then again for the password etc,
> you want it all at once.
> 
> 
> Any feedback?
> 
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> <https://blog-rmannibucau.rhcloud.com> | Old Blog
> <http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | JavaEE Factory
> <https://javaeefactory-rmannibucau.rhcloud.com>

Reply via email to