public abstract class ChannelSender extends Object
| Modifier and Type | Field and Description |
|---|---|
protected String |
host |
protected long |
lastUsed |
protected ComponentLog |
logger |
protected int |
maxSendBufferSize |
protected int |
port |
protected int |
timeout |
| Constructor and Description |
|---|
ChannelSender(String host,
int port,
int maxSendBufferSize,
ComponentLog logger) |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
close()
Close the underlying channel
|
long |
getLastUsed() |
int |
getTimeout() |
abstract boolean |
isConnected() |
abstract void |
open()
Opens the connection to the destination.
|
void |
send(byte[] data)
Sends the given data over the channel.
|
void |
send(String message,
Charset charset)
Sends the given string over the channel.
|
void |
setTimeout(int timeout) |
protected abstract void |
write(byte[] data)
Write the given buffer to the underlying channel.
|
protected final int port
protected final String host
protected final int maxSendBufferSize
protected final ComponentLog logger
protected volatile int timeout
protected volatile long lastUsed
public ChannelSender(String host, int port, int maxSendBufferSize, ComponentLog logger)
public void setTimeout(int timeout)
public int getTimeout()
public long getLastUsed()
public abstract void open()
throws IOException
IOException - if an error occurred opening the connection.public void send(String message, Charset charset) throws IOException
message - the message to send over the channelIOException - if there was an error communicating over the channelpublic void send(byte[] data)
throws IOException
data - the data to send over the channelIOException - if there was an error communicating over the channelprotected abstract void write(byte[] data)
throws IOException
IOExceptionpublic abstract boolean isConnected()
public abstract void close()
Copyright © 2019 Apache NiFi Project. All rights reserved.