Class TLSSyslogConnection
- java.lang.Object
-
- ch.admin.bag.covidcertificate.log.syslog.connection.TLSSyslogConnection
-
public class TLSSyslogConnection extends Object
-
-
Constructor Summary
Constructors Constructor Description TLSSyslogConnection(String syslogHost, int port, SSLContext sslContext, ch.qos.logback.core.net.ssl.SSLParametersConfiguration sslParameters, int timeoutMillis)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidattemptConnection()Attempts to connect, initializes theclientSocketconnected to the syslog server and sets the connection state to connected.static TLSSyslogConnectioncreate(String syslogHost, int port, ch.qos.logback.core.net.ssl.SSLConfiguration ssl, ch.qos.logback.core.spi.ContextAware context, int timeoutMillis)voiddisconnect()StringgetLastTransmitError()booleantransmit(byte[] syslogMessage)Writes the messge to the TCP socket's write buffer, attempting to reconnect if necessary
-
-
-
Constructor Detail
-
TLSSyslogConnection
public TLSSyslogConnection(String syslogHost, int port, SSLContext sslContext, ch.qos.logback.core.net.ssl.SSLParametersConfiguration sslParameters, int timeoutMillis)
-
-
Method Detail
-
create
public static TLSSyslogConnection create(String syslogHost, int port, ch.qos.logback.core.net.ssl.SSLConfiguration ssl, ch.qos.logback.core.spi.ContextAware context, int timeoutMillis) throws GeneralSecurityException
- Throws:
GeneralSecurityException
-
transmit
public boolean transmit(byte[] syslogMessage)
Writes the messge to the TCP socket's write buffer, attempting to reconnect if necessary- Returns:
- true if the message has been successfully written to the TCP socket's write buffer, false if any error occurred
-
attemptConnection
public void attemptConnection()
Attempts to connect, initializes theclientSocketconnected to the syslog server and sets the connection state to connected.If the connection attempt is unsuccessful, the error is logged once per application run to stderr, and the connection is left in disconnected state. No exception is thrown in this case to allow logging to the fallback appender or a reconnection attempt in this case.
-
disconnect
public void disconnect()
-
getLastTransmitError
public String getLastTransmitError()
-
-