override fun clusterChanged()

in src/main/kotlin/org/opensearch/replication/task/index/IndexReplicationTask.kt [867:882]


    override fun clusterChanged(event: ClusterChangedEvent) {
        log.debug("Cluster metadata listener invoked on index task...")
        if (event.metadataChanged()) {
            val replicationStateParams = getReplicationStateParamsForIndex(clusterService, followerIndexName)
            log.debug("$replicationStateParams from the cluster state")
            if (replicationStateParams == null) {
                if (PersistentTasksNodeService.Status(State.STARTED) == status) {
                    log.info("Cancelling index replication stop")
                    cancelTask("Index replication task received an interrupt.")
                }
            } else if (replicationStateParams[REPLICATION_LAST_KNOWN_OVERALL_STATE] == ReplicationOverallState.PAUSED.name){
                log.info("Pause state received for index $followerIndexName task")
                cancelTask("Index replication task received a pause.")
            }
        }
    }