io.vertx.core.spi.cluster

## Interface NodeSelector

-     public interface NodeSelector

  Used by the `clustered EventBus` to select a node for a given message..

  This selector is skipped only when the user raises the `DeliveryOptions.setLocalOnly(boolean)` flag. Consequently, implementations must be aware of local `EventBus` registrations.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `eventBusStarted()` Invoked after the clustered `EventBus` has started.
    `void` | `init(Vertx vertx, ClusterManager clusterManager)` Invoked before the `vertx` instance tries to join the cluster.
    `void` | `registrationsLost()` Invoked by the `ClusterManager` when some handler registrations have been lost.
    `void` | `registrationsUpdated(RegistrationUpdateEvent event)` Invoked by the `ClusterManager` when messaging handler registrations are added or removed.
    `void` | `selectForPublish(Message<?> message, Promise<Iterable<String>> promise)` Select a node for publishing the given `message`.
    `void` | `selectForSend(Message<?> message, Promise<String> promise)` Select a node for sending the given `message`.

- - ### Method Detail

    - #### init

          void init(Vertx vertx,
                    ClusterManager clusterManager)

      Invoked before the `vertx` instance tries to join the cluster.

    - #### eventBusStarted

          void eventBusStarted()

      Invoked after the clustered `EventBus` has started.

    - #### selectForSend

          void selectForSend(Message<?> message,
                             Promise<String> promise)

      Select a node for sending the given `message`.

      The provided `promise` needs to be completed with `Promise.tryComplete(T)` and `Promise.tryFail(java.lang.Throwable)` as it might completed outside the selector.

      Throws:
        `IllegalArgumentException` - if `Message.isSend()` returns `false`

    - #### selectForPublish

          void selectForPublish(Message<?> message,
                                Promise<Iterable<String>> promise)

      Select a node for publishing the given `message`.

      The provided `promise` needs to be completed with `Promise.tryComplete(T)` and `Promise.tryFail(java.lang.Throwable)` as it might completed outside the selector.

      Throws:
        `IllegalArgumentException` - if `Message.isSend()` returns `true`

    - #### registrationsUpdated

          void registrationsUpdated(RegistrationUpdateEvent event)

      Invoked by the `ClusterManager` when messaging handler registrations are added or removed.

    - #### registrationsLost

          void registrationsLost()

      Invoked by the `ClusterManager` when some handler registrations have been lost.

Copyright © 2021 Eclipse. All rights reserved.