Skip to content

ClusterReadyEvent description

Leonid edited this page Jun 15, 2020 · 1 revision

Cluster have set of nodes hosted on different hosts.

Nodes are entering cluster not at the same time but Ignite allows you to use cluster even when not all nodes in the cluster exists, and some of them maybe failed to start.

In this situation when you want to use cluster only if all nodes successfully started you should listen to ClusterReadyEvent

When all nodes entered the cluster and cluster is ready for tasks, ClusterReadyEvent fires on every node of the cluster.

@Slf4j
@Service
@RequiredArgsConstructor
public class ClusterReadyConsumer implements ApplicationListener<ClusterReadyEvent> {
  private final Cluster cluster;

  @Override
  public void onApplicationEvent(@NotNull ClusterReadyEvent event) {
    log.info("Cluster is ready: {}", event);
  }
}
Clone this wiki locally