-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Feature context and Async Filters #43435
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
Merged
mrm9084
merged 7 commits into
Azure:SpringCloudAzure6.0-Preview
from
mrm9084:FeatureContext
Feb 5, 2025
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
c365690
Object Context and AsyncFilters
mrm9084 671ed2b
Apply suggestions from code review
mrm9084 b6673cc
Review comments
mrm9084 7fb2608
Merge branch 'SpringCloudAzure6.0-Preview' into FeatureContext
mrm9084 e62b27d
Review comments
mrm9084 2acd179
Review Comments
mrm9084 51d5c5b
Merge branch 'SpringCloudAzure6.0-Preview' into FeatureContext
mrm9084 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
.../main/java/com/azure/spring/cloud/feature/management/filters/ContextualFeatureFilter.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
| package com.azure.spring.cloud.feature.management.filters; | ||
|
|
||
| import com.azure.spring.cloud.feature.management.models.FeatureFilterEvaluationContext; | ||
|
|
||
| /** | ||
| * A Filter for Feature Management that is attached to Features. The filter needs to have @Component set to be found by | ||
| * feature management. As a Contextual feature filter any context that is passed in to the feature request will be | ||
| * passed along to the filter(s). | ||
| */ | ||
| @FunctionalInterface | ||
| public interface ContextualFeatureFilter { | ||
|
|
||
| /** | ||
| * Evaluates if the filter is on or off. Returning true results in Feature evaluation ending and returning true. | ||
| * Returning false results in the next Feature evaluation to continue. | ||
| * | ||
| * @param context The context for whether or not the filter is passed. | ||
| * @param appContext The internal app context | ||
| * @return True if the feature is enabled, false otherwise. | ||
| */ | ||
| boolean evaluate(FeatureFilterEvaluationContext context, Object appContext); | ||
|
|
||
| } |
27 changes: 27 additions & 0 deletions
27
.../java/com/azure/spring/cloud/feature/management/filters/ContextualFeatureFilterAsync.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
| package com.azure.spring.cloud.feature.management.filters; | ||
|
|
||
| import com.azure.spring.cloud.feature.management.models.FeatureFilterEvaluationContext; | ||
|
|
||
| import reactor.core.publisher.Mono; | ||
|
|
||
| /** | ||
| * A Filter for Feature Management that is attached to Features. The filter needs to have @Component set to be found by | ||
| * feature management. As a Contextual feature filter any context that is passed in to the feature request will be | ||
| * passed along to the filter(s). | ||
| */ | ||
| @FunctionalInterface | ||
| public interface ContextualFeatureFilterAsync { | ||
|
|
||
| /** | ||
| * Evaluates if the filter is on or off. Returning true results in Feature evaluation ending and returning true. | ||
| * Returning false results in the next Feature evaluation to continue. | ||
| * | ||
| * @param context The context for whether or not the filter is passed. | ||
| * @param appContext The internal app context | ||
| * @return true if the feature is enabled, false otherwise. | ||
| */ | ||
| Mono<Boolean> evaluateAsync(FeatureFilterEvaluationContext context, Object appContext); | ||
|
|
||
| } |
25 changes: 25 additions & 0 deletions
25
...t/src/main/java/com/azure/spring/cloud/feature/management/filters/FeatureFilterAsync.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
| package com.azure.spring.cloud.feature.management.filters; | ||
|
|
||
| import com.azure.spring.cloud.feature.management.models.FeatureFilterEvaluationContext; | ||
|
|
||
| import reactor.core.publisher.Mono; | ||
|
|
||
| /** | ||
| * A Filter for Feature Management that is attached to Features. The filter needs to have @Component set to be found by | ||
| * feature management. | ||
| */ | ||
| @FunctionalInterface | ||
| public interface FeatureFilterAsync { | ||
|
|
||
| /** | ||
| * Evaluates if the filter is on or off. Returning true results in Feature evaluation ending and returning true. | ||
| * Returning false results in the next Feature evaluation to continue. | ||
| * | ||
| * @param context The context for whether or not the filter is passed. | ||
| * @return True if the feature is enabled, false otherwise. | ||
| */ | ||
| Mono<Boolean> evaluateAsync(FeatureFilterEvaluationContext context); | ||
|
mrm9084 marked this conversation as resolved.
|
||
|
|
||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 request is the right word since it's still relevant outside of requests. Maybe DEFAULT_BLOCK_TIMEOUT
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.
Updated to this in the variants PR