Skip to content

Commit 2952e68

Browse files
committed
refactor: keep InformerEventSource.addIndexers undeprecated for dynamic use
Dynamically registered informers can still add indexers at runtime. Document that purpose and point to the builder otherwise. Signed-off-by: Exar-lab <exarviquezmasis@gmail.com>
1 parent 4b15b56 commit 2952e68

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

‎docs/content/en/docs/documentation/working-with-es-caches.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,8 @@ With this index in place, you can retrieve the target resources very efficiently
218218

219219
The same can be done for the cache of a secondary resource: indexers are configured on the
220220
`InformerEventSourceConfiguration.Builder`, and are registered before the event source starts.
221-
Calling `InformerEventSource.addIndexers(..)` directly is deprecated:
221+
`InformerEventSource.addIndexers(..)` is only meant for the dynamic case, where an informer is
222+
registered at runtime and its indexers are only known at that point. Otherwise, use the builder:
222223

223224
```java
224225
InformerEventSource<ConfigMap, MyResource> configMapEventSource =

‎operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/InformerEventSource.java‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,11 @@ public InformerEventSource(InformerEventSourceConfiguration<R> configuration) {
8585
}
8686

8787
/**
88-
* @deprecated configure indexers with {@link
89-
* InformerEventSourceConfiguration.Builder#withIndexer(String, Function)} instead
88+
* Adds indexers to an already created event source, for example when the informer is registered
89+
* dynamically and its indexers are only known at that point. Indexers known upfront should be
90+
* configured with {@link InformerEventSourceConfiguration.Builder#withIndexer(String, Function)}
91+
* instead.
9092
*/
91-
@Deprecated
9293
@Override
9394
public void addIndexers(Map<String, Function<R, List<String>>> indexers) {
9495
super.addIndexers(indexers);

0 commit comments

Comments
 (0)