-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: document setProviderAndWait in README #610
docs: document setProviderAndWait in README #610
Conversation
- Updated the setProviderAndWait example in the quick start section - Expand the provider's section to show both the async and synchronous options. Signed-off-by: Yash <[email protected]>
README.md
Outdated
#### Asynchronous Named Provider Configuration | ||
|
||
To register providers asynchronously, ensuring they are initialized before further actions are taken, you can use the `setProviderAndWait` method as shown below: | ||
|
||
```java | ||
FeatureProvider scopedProvider = new MyProvider(); | ||
|
||
// registering the default provider | ||
// registering the default provider asynchronously | ||
OpenFeatureAPI.getInstance().setProviderAndWait(LocalProvider()); | ||
// registering a named provider asynchronously | ||
OpenFeatureAPI.getInstance().setProviderAndWait("clientForCache", new CachedProvider()); | ||
|
||
// a client backed by the default provider | ||
Client clientDefault = OpenFeatureAPI.getInstance().getClient(); | ||
// a client backed by CachedProvider | ||
Client clientNamed = OpenFeatureAPI.getInstance().getClient("clientForCache"); | ||
``` | ||
|
||
#### Synchronous Named Provider Configuration | ||
|
||
For synchronous provider registration, where you set the provider without waiting for initialization, you can use the `setProvider` method directly, as shown in the following example: | ||
|
||
```java | ||
FeatureProvider scopedProvider = new MyProvider(); | ||
|
||
// registering the default provider synchronously |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you need to repeat yourself here. Just mention that named providers can be set in a blocking/non-blocking way, and then link to the previous doc you wrote above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @code4Y , this is a great start!
I left a few comments.
Also note, we use PR titles for semantic commit messages - so I've made a change to the title (this will be the commit message when we merge).
- blocking / non-blocking terms added in Providers section - removed repetition of code and added link in Named clients Signed-off-by: Yash <[email protected]>
Hey @toddbaert, thank you for your guidance! I've made the requested changes. Please take a look at them and let me know if there's anything else I need to improve. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@code4Y you can disregard the CI failure. It's not related to your change. |
Kudos, SonarCloud Quality Gate passed! |
Codecov Report
@@ Coverage Diff @@
## main #610 +/- ##
============================================
+ Coverage 94.45% 94.81% +0.35%
- Complexity 360 362 +2
============================================
Files 32 32
Lines 848 848
Branches 52 52
============================================
+ Hits 801 804 +3
+ Misses 25 23 -2
+ Partials 22 21 -1
Flags with carried forward coverage won't be shown. Click here to find out more. see 2 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
This PR
setProviderAndWait
example in the quick start sectionRelated Issues
Update readme examples to include
setProviderAndWait
Fixes #592
Notes
If there are any corrections, please let me know.