Observe settings via provider
Requires: main module.
One can subscribe to settings updates for a type with configuration provider's Observe method.
With prior assignment of sources:
With sources passed on per-call basis:
Temporary subscriptions should be disposed of as they might hold on to resources in sources:
Observe method behavior
OnError
andOnCompleted
notifications are never produced. Only successful settings updates are propagated to the observers. This means that there will be no notifications if initial attempt to provide settings fails with an error and no further data updates are published by the source.The only way to notice errors when using Observe is to enable error logging.
The subscription is not guaranteed to immediately produce a notification. The first notification may be delayed due to data not having been fetched from the source yet. However, once a valid settings instance has been observed, all new observers receive a notification with current actual settings upon subscription. This notification is published on a background thread, so don't count on it being delivered after
Subscribe
call completes.
Best practices
It's recommended to obtain initial settings instance with Get method before subscribing to updates with Observe. This practice ensures correct error propagation, warms up the cache and eliminates situations where the settings are not ready yet on access attempt.
Related pages
Last updated
Was this helpful?