public class NettyLumberJackClientImpl extends NettyAbstractClient implements NettyReaderByteBufCallback, NettyTcpClient<Map<String,String>>
In fact this class only defines the high level interface, the real work is performed
by the NettyLumberJackClientRunner.
rawbootstrap, host, maxPayloadLength, metricsContext, port, protocol, readSocketTimeoutAction, readSocketTimeoutMs, ssl, sslCiphers, sslProtocol, sslProvider, useNettyCompression| Constructor and Description |
|---|
NettyLumberJackClientImpl(org.thales.punch.settings.api.ISettingsMap settings,
org.thales.punch.libraries.metrics.api.IMetricContext metricsContext,
NettyDataAcker acker)
Return a new NettyLumberJackTcpClient.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
onDisconnected(Throwable e) |
void |
onReceive(io.netty.channel.ChannelHandlerContext ctx,
io.netty.buffer.ByteBuf data,
com.codahale.metrics.Counter rec,
com.codahale.metrics.Counter sent)
Called when the underlying client has received some data from the server
|
NettyTcpClient<Map<String,String>> |
setConnectionCallback(INettyConnectionCallback cb)
Request to be told upon connection/disconnection with the target server.
|
NettyTcpClient<Map<String,String>> |
setName(String name)
Associate a name to the client.
|
NettyLumberJackClientImpl |
start()
Start the client.
|
NettyTcpClient<Map<String,String>> |
stop()
Stop the client.
|
String |
toString() |
boolean |
write(Map<String,String> data)
Write some line of data to the server.
|
boolean |
write(Map<String,String> data,
Object context)
Write some line of data to the server using an acknowledgement mode.
|
connect, getConnectIntervalMs, getConnectRetryIntervalMs, getSslContext, setConnectIntervalMs, setConnectRetryIntervalMs, shutdowngetFileFromString, getSslProviderpublic NettyLumberJackClientImpl(org.thales.punch.settings.api.ISettingsMap settings,
org.thales.punch.libraries.metrics.api.IMetricContext metricsContext,
NettyDataAcker acker)
settings - the client settingsmetricsContext - the metric contextacker - the data ackerpublic void onReceive(io.netty.channel.ChannelHandlerContext ctx,
io.netty.buffer.ByteBuf data,
com.codahale.metrics.Counter rec,
com.codahale.metrics.Counter sent)
onReceive in interface NettyReaderByteBufCallbackctx - the receiving channel context .data - the received data.rec - the received data counter.sent - the sent data counter.public boolean write(Map<String,String> data) throws NettyException
NettyTcpClientwrite in interface NettyTcpClient<Map<String,String>>data - the data to sendNettyException - if the client queue capacity is reached and the connection to the server is down for more than
the configured timeout.public boolean write(Map<String,String> data, Object context)
NettyTcpClientwrite in interface NettyTcpClient<Map<String,String>>data - the data to sendcontext - some opaque context you need for the ack or fail callback.public NettyLumberJackClientImpl start()
start in interface NettyTcpClient<Map<String,String>>public NettyTcpClient<Map<String,String>> setConnectionCallback(INettyConnectionCallback cb)
NettyTcpClientIt can be null and will have no effect.
setConnectionCallback in interface NettyTcpClient<Map<String,String>>cb - the user callbackpublic NettyTcpClient<Map<String,String>> stop()
NettyTcpClientstop in interface NettyTcpClient<Map<String,String>>public NettyTcpClient<Map<String,String>> setName(String name)
NettyTcpClientsetName in interface NettyTcpClient<Map<String,String>>name - the client nameprotected void onDisconnected(Throwable e)
Copyright © 2023. All rights reserved.