Skip to content

Introduce cluster operations #1768

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

sothawo
Copy link
Collaborator

@sothawo sothawo commented Apr 11, 2021

This PR adds a cluster operations interface and implements the cluster health function.

Sample Usage:

reactive:

@RestController
@RequestMapping("system")
public class SystemController {

    private final ReactiveElasticsearchOperations operations;

    public SystemController(ReactiveElasticsearchOperations operations) {
        this.operations = operations;
    }

    @GetMapping("/cluster/health")
    public Mono<ClusterHealth> clusterHealth() {
        return operations.cluster().health();
    }
}

imperative:

@RestController
@RequestMapping("system")
public class SystemController {

    private final ElasticsearchOperations operations;

    public SystemController(ElasticsearchOperations operations) {
        this.operations = operations;
    }

    @GetMapping("/cluster/health")
    public ClusterHealth clusterHealth() {
        return operations.cluster().health();
    }
}

Having the cluster health functionality available in the ReactiveElasticsearchClient makes way for improving reactive Spring Boot Actuator to enable actuator calls, when the user has configured a dynamic header supplier (currentyl this needs a custom health provider).

Closes #1390

@sothawo sothawo merged commit d561c91 into spring-projects:master Apr 11, 2021
@sothawo sothawo deleted the #1390-Introduce-cluster-operations branch April 11, 2021 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Introduce ClusterOperations [DATAES-818]
1 participant