public class GraphiteRabbitMQ extends Object implements GraphiteSender
| Constructor and Description |
|---|
GraphiteRabbitMQ(com.rabbitmq.client.ConnectionFactory connectionFactory,
String exchange)
Creates a new client with a given a
ConnectionFactory and an amqp exchange |
GraphiteRabbitMQ(String rabbitHost,
Integer rabbitPort,
String rabbitUsername,
String rabbitPassword,
String exchange)
Creates a new client given connection details
|
GraphiteRabbitMQ(String rabbitHost,
Integer rabbitPort,
String rabbitUsername,
String rabbitPassword,
String exchange,
Integer rabbitConnectionTimeoutMS,
Integer rabbitSocketTimeoutMS,
Integer rabbitRequestedHeartbeatInSeconds)
Creates a new client given connection details
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
connect()
Connects to the server.
|
void |
flush()
Flushes buffer, if applicable
|
int |
getFailures()
Returns the number of failed writes to the server.
|
boolean |
isConnected()
Returns true if ready to send data
|
String |
sanitize(String s) |
void |
send(String name,
String value,
long timestamp)
Sends the given measurement to the server.
|
public GraphiteRabbitMQ(com.rabbitmq.client.ConnectionFactory connectionFactory,
String exchange)
ConnectionFactory and an amqp exchangeconnectionFactory - the ConnectionFactory used to establish connection and publish to graphite serverexchange - the amqp exchangepublic GraphiteRabbitMQ(String rabbitHost, Integer rabbitPort, String rabbitUsername, String rabbitPassword, String exchange)
rabbitHost - the rabbitmq server hostrabbitPort - the rabbitmq server portrabbitUsername - the rabbitmq server usernamerabbitPassword - the rabbitmq server passwordexchange - the amqp exchangepublic GraphiteRabbitMQ(String rabbitHost, Integer rabbitPort, String rabbitUsername, String rabbitPassword, String exchange, Integer rabbitConnectionTimeoutMS, Integer rabbitSocketTimeoutMS, Integer rabbitRequestedHeartbeatInSeconds)
rabbitHost - the rabbitmq server hostrabbitPort - the rabbitmq server portrabbitUsername - the rabbitmq server usernamerabbitPassword - the rabbitmq server passwordexchange - the amqp exchangerabbitConnectionTimeoutMS - the connection timeout in millisecondsrabbitSocketTimeoutMS - the socket timeout in millisecondsrabbitRequestedHeartbeatInSeconds - the hearthbeat in secondspublic void connect()
throws IllegalStateException,
IOException
GraphiteSenderconnect in interface GraphiteSenderIllegalStateException - if the client is already connectedIOException - if there is an error connectingpublic boolean isConnected()
GraphiteSenderisConnected in interface GraphiteSenderpublic void send(String name, String value, long timestamp) throws IOException
GraphiteSendersend in interface GraphiteSendername - the name of the metricvalue - the value of the metrictimestamp - the timestamp of the metricIOException - if there was an error sending the metricpublic void flush()
throws IOException
GraphiteSenderflush in interface GraphiteSenderIOException - if there was an error during flushing metrics to the socketpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic int getFailures()
GraphiteSendergetFailures in interface GraphiteSenderCopyright © 2020. All rights reserved.