public class InfluxDbUdpSender extends Object implements InfluxDbSender
| Constructor and Description |
|---|
InfluxDbUdpSender(InetSocketAddress address)
Creates a new client which sends data to given address using UDP
|
InfluxDbUdpSender(String hostname,
int port)
Creates a new client which sends data to given address using UDP
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
connect()
Connects to the server.
|
void |
disconnect()
Disconnects from the server.
|
void |
flush()
Flushes buffer, if applicable
|
boolean |
isConnected()
Returns true if ready to send data
|
void |
send(StringBuilder str)
Sends the given measurement to the server.
|
public InfluxDbUdpSender(String hostname, int port)
hostname - The hostname of the InfluxDb serverport - The port of the InfluxDb serverpublic InfluxDbUdpSender(InetSocketAddress address)
address - the address of the InfluxDb serverpublic void connect()
throws IllegalStateException,
IOException
InfluxDbSenderconnect in interface InfluxDbSenderIllegalStateException - if the client is already connectedIOException - if there is an error connectingpublic boolean isConnected()
InfluxDbSenderisConnected in interface InfluxDbSenderpublic void disconnect()
throws IOException
InfluxDbSenderdisconnect in interface InfluxDbSenderIOException - if there is an error disconnectingpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic void send(StringBuilder str) throws IOException
InfluxDbSender
NOTE: The caller may modify the measurement buffer after this call.
The implementation of this method MUST NOT keep any reference to the buffer after this call.
send in interface InfluxDbSenderstr - a single measurement line,
according to the InfluxDb line protocol including a trailing newline.IOException - if there was an error sending the metricpublic void flush()
throws IOException
InfluxDbSenderflush in interface InfluxDbSenderIOException - if there was an error during flushing metrics to the serverCopyright © 2019. All rights reserved.