Details
-
Improvement
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
Description
Ability to add listeners with "any()" placeholder will ease the logic of registering ones.
Let's say that we want to listen to a changes of a column type within any column of any table. Now the only option is to register type listeners from within column listeners within table listeners:
clusterCfgMgr.configurationRegistry().getConfiguration(TablesConfiguration.KEY).tables().listenElements( new ConfigurationNamedListListener<TableView>() { @Override public @NotNull CompletableFuture<?> onCreate(@NotNull ConfigurationNotificationEvent<TableView> tblCtx) { clusterCfgMgr.configurationRegistry().getConfiguration(TablesConfiguration.KEY).tables(). get(tblCtx.newValue().name()).columns().listenElements( new ConfigurationNamedListListener<ColumnView>() { @Override public @NotNull CompletableFuture<?> onCreate( @NotNull ConfigurationNotificationEvent<ColumnView> columnCtx) { clusterCfgMgr.configurationRegistry().getConfiguration(TablesConfiguration.KEY).tables(). get(tblCtx.newValue().name()).columns().get(columnCtx.newValue().name()).listen((typeCtx) -> null); return CompletableFuture.completedFuture(null); } }); return CompletableFuture.completedFuture(null); }
With any placeholder it will look like much simpler:
clusterCfgMgr.configurationRegistry().getConfiguration(TablesConfiguration.KEY).tables().any().columns().
any().type().listen(ctx -> null);
Besides obvious there are at least two important points here:
- It should be possible to retrieve full context/"full configuration locator" from the listener's context. In this particular case, type().listen(ctx -> null) should provide context of the table and the column that were changed.
- It should be possible to remove such "any" listeners.
Attachments
Issue Links
- is caused by
-
IGNITE-16231 Use any() for tracking updates of schema
- Resolved
- links to