public interface SchemaChangeListener extends AutoCloseable
Implementations of this interface can be registered either via the configuration (see reference.conf
in the manual or core driver JAR), or programmatically via SessionBuilder.addSchemaChangeListener(SchemaChangeListener)
.
Note that the methods defined by this interface will be executed by internal driver threads, and are therefore expected to have short execution times. If you need to perform long computations or blocking calls in response to schema change events, it is strongly recommended to schedule them asynchronously on a separate thread provided by your application code.
If you implement this interface but don't need to implement all the methods, extend SchemaChangeListenerBase
.
close
void onKeyspaceCreated(@NonNull KeyspaceMetadata keyspace)
void onKeyspaceDropped(@NonNull KeyspaceMetadata keyspace)
void onKeyspaceUpdated(@NonNull KeyspaceMetadata current, @NonNull KeyspaceMetadata previous)
void onTableCreated(@NonNull TableMetadata table)
void onTableDropped(@NonNull TableMetadata table)
void onTableUpdated(@NonNull TableMetadata current, @NonNull TableMetadata previous)
void onUserDefinedTypeCreated(@NonNull UserDefinedType type)
void onUserDefinedTypeDropped(@NonNull UserDefinedType type)
void onUserDefinedTypeUpdated(@NonNull UserDefinedType current, @NonNull UserDefinedType previous)
void onFunctionCreated(@NonNull FunctionMetadata function)
void onFunctionDropped(@NonNull FunctionMetadata function)
void onFunctionUpdated(@NonNull FunctionMetadata current, @NonNull FunctionMetadata previous)
void onAggregateCreated(@NonNull AggregateMetadata aggregate)
void onAggregateDropped(@NonNull AggregateMetadata aggregate)
void onAggregateUpdated(@NonNull AggregateMetadata current, @NonNull AggregateMetadata previous)
void onViewCreated(@NonNull ViewMetadata view)
void onViewDropped(@NonNull ViewMetadata view)
void onViewUpdated(@NonNull ViewMetadata current, @NonNull ViewMetadata previous)
default void onSessionReady(@NonNull Session session)
This corresponds to the moment when SessionBuilder.build()
returns, or the future
returned by SessionBuilder.buildAsync()
completes. If the session initialization fails,
this method will not get called.
Listener methods are invoked from different threads; if you store the session in a field, make it at least volatile to guarantee proper publication.
This method is guaranteed to be the first one invoked on this object.
The default implementation is empty.
Copyright © 2017–2024. All rights reserved.