You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Alexander Lapin (Jira)" <ji...@apache.org> on 2021/08/31 14:57:00 UTC
[jira] [Created] (IGNITE-15409) Configuration registry: register
listener with any placeholder on NamedConfigurationTree
Alexander Lapin created IGNITE-15409:
----------------------------------------
Summary: Configuration registry: register listener with any placeholder on NamedConfigurationTree
Key: IGNITE-15409
URL: https://issues.apache.org/jira/browse/IGNITE-15409
Project: Ignite
Issue Type: Improvement
Reporter: Alexander Lapin
Assignee: Ivan Bessonov
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:
{code:java}
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);
}
{code}
With any placeholder it will look like much simpler:
{code:java}
clusterCfgMgr.configurationRegistry().getConfiguration(TablesConfiguration.KEY).tables().any().columns().
any().type().listen(ctx -> null);
{code}
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
--
This message was sent by Atlassian Jira
(v8.3.4#803005)