public class Client extends ConnectionWithStatus implements IStatefulObject, 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.
ConnectionWithStatus.Status
Modifier and Type | Field and Description |
---|---|
protected String |
dstAddressPrefixedName |
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.
|
Object |
getState() |
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() |
protected final String dstAddressPrefixedName
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.
status
in class ConnectionWithStatus
public void sendLoadMetrics(Map<Integer,Double> taskToLoad)
IConnection
Send load metrics to all downstream connections.
sendLoadMetrics
in interface IConnection
taskToLoad
- a map from the task id to the load for that task.public void sendBackPressureStatus(BackPressureStatus bpStatus)
IConnection
Sends the back pressure metrics to all downstream connections.
sendBackPressureStatus
in interface IConnection
public void send(Iterator<TaskMessage> msgs)
Enqueue task messages to be sent to the remote destination (cf. host
and port
).
send
in interface IConnection
public InetSocketAddress getDstAddress()
public int getPort()
IConnection
Get the port for this connection.
getPort
in interface IConnection
public void close()
Gracefully close this client.
close
in interface AutoCloseable
close
in interface IConnection
public Map<Integer,Load> getLoad(Collection<Integer> tasks)
IConnection
Get the current load for the given tasks.
getLoad
in interface IConnection
tasks
- the tasks to look for.public Object getState()
getState
in interface IStatefulObject
public void channelReady(org.apache.storm.shade.io.netty.channel.Channel channel)
channelReady
in interface ISaslClient
public String name()
name
in interface ISaslClient
public String secretKey()
secretKey
in interface ISaslClient
Copyright © 2020 The Apache Software Foundation. All rights reserved.