org.apache.storm.messaging.netty

## Class Client

- java.lang.Object
- - org.apache.storm.messaging.ConnectionWithStatus
  - - org.apache.storm.messaging.netty.Client

- All Implemented Interfaces:
    AutoCloseable, IConnection, ISaslClient

      public class Client
      extends ConnectionWithStatus
      implements ISaslClient

  A Netty client for sending task messages to a remote destination (Netty server).

  Implementation details:

  Sending messages, i.e. writing to the channel, is performed asynchronously. Messages are sent in batches to optimize for network throughput at the expense of network latency. The message batch size is configurable. Connecting and reconnecting are performed asynchronously. Note: The current implementation drops any messages that are being enqueued for sending if the connection to the remote destination is currently unavailable.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.storm.messaging.ConnectionWithStatus

      `ConnectionWithStatus.Status`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected String` | `dstAddressPrefixedName`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `channelReady(org.apache.storm.shade.io.netty.channel.Channel channel)`
    `void` | `close()` Gracefully close this client.
    `Map<String,Object>` | `getConfig()`
    `InetSocketAddress` | `getDstAddress()`
    `Map<Integer,Load>` | `getLoad(Collection<Integer> tasks)` Get the current load for the given tasks.
    `int` | `getPort()` Get the port for this connection.
    `String` | `name()`
    `String` | `secretKey()`
    `void` | `send(Iterator<TaskMessage> msgs)` Enqueue task messages to be sent to the remote destination (cf.
    `void` | `sendBackPressureStatus(BackPressureStatus bpStatus)` Sends the back pressure metrics to all downstream connections.
    `void` | `sendLoadMetrics(Map<Integer,Double> taskToLoad)` Send load metrics to all downstream connections.
    `ConnectionWithStatus.Status` | `status()` Note: Storm will check via this method whether a worker can be activated safely during the initial startup of a topology.
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### dstAddressPrefixedName

          protected final String dstAddressPrefixedName

  - ### Method Detail

    - #### status

          public ConnectionWithStatus.Status status()

      Note: Storm will check via this method whether a worker can be activated safely during the initial startup of a topology. The worker will only be activated once all of the its connections are ready.

      Specified by:
        `status` in class `ConnectionWithStatus`

    - #### sendLoadMetrics

          public void sendLoadMetrics(Map<Integer,Double> taskToLoad)

      Description copied from interface: `IConnection`

      Send load metrics to all downstream connections.

      Specified by:
        `sendLoadMetrics` in interface `IConnection`
      Parameters:
        `taskToLoad` - a map from the task id to the load for that task.

    - #### sendBackPressureStatus

          public void sendBackPressureStatus(BackPressureStatus bpStatus)

      Description copied from interface: `IConnection`

      Sends the back pressure metrics to all downstream connections.

      Specified by:
        `sendBackPressureStatus` in interface `IConnection`

    - #### send

          public void send(Iterator<TaskMessage> msgs)

      Enqueue task messages to be sent to the remote destination (cf. `host` and `port`).

      Specified by:
        `send` in interface `IConnection`

    - #### getDstAddress

          public InetSocketAddress getDstAddress()

    - #### getPort

          public int getPort()

      Description copied from interface: `IConnection`

      Get the port for this connection.

      Specified by:
        `getPort` in interface `IConnection`
      Returns:
        The port this connection is using

    - #### close

          public void close()

      Gracefully close this client.

      Specified by:
        `close` in interface `AutoCloseable`
      Specified by:
        `close` in interface `IConnection`

    - #### getLoad

          public Map<Integer,Load> getLoad(Collection<Integer> tasks)

      Description copied from interface: `IConnection`

      Get the current load for the given tasks.

      Specified by:
        `getLoad` in interface `IConnection`
      Parameters:
        `tasks` - the tasks to look for.
      Returns:
        a Load for each of the tasks it knows about.

    - #### getConfig

          public Map<String,Object> getConfig()

    - #### channelReady

          public void channelReady(org.apache.storm.shade.io.netty.channel.Channel channel)

      Specified by:
        `channelReady` in interface `ISaslClient`

    - #### name

          public String name()

      Specified by:
        `name` in interface `ISaslClient`

    - #### secretKey

          public String secretKey()

      Specified by:
        `secretKey` in interface `ISaslClient`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2021 The Apache Software Foundation. All rights reserved.