public class NettyHttpClientImpl extends NettyAbstractClient implements INettyReaderCallback<Map<String,Object>>, NettyTcpClient<String>
| Modifier and Type | Field and Description |
|---|---|
static int |
MAX_FRAME_SIZE_DEFAULT_VALUE |
static String |
MAX_FRAME_SIZE_KEY |
rawbootstrap, host, maxPayloadLength, metricsContext, port, protocol, readSocketTimeoutAction, readSocketTimeoutMs, ssl, sslCiphers, sslProtocol, sslProvider, useNettyCompression| Constructor and Description |
|---|
NettyHttpClientImpl(org.thales.punch.settings.api.ISettingsMap settings,
org.thales.punch.libraries.metrics.api.IMetricContext metricsContext,
NettyDataAcker acker)
Return a new NettyHttpTcpClient.
|
| Modifier and Type | Method and Description |
|---|---|
Class<?> |
getType() |
void |
onReceive(io.netty.channel.ChannelHandlerContext ctx,
INettyTuple<Map<String,Object>> in)
Called when the underlying client has received some data from the server
Do nothing now.
|
NettyTcpClient<String> |
setCallback(INettyReaderCallback<Map<String,Object>> callback) |
NettyTcpClient<String> |
setConnectionCallback(INettyConnectionCallback cb)
Request to be told upon connection/disconnection with the target server.
|
NettyTcpClient<String> |
setName(String name)
Associate a name to the client.
|
NettyHttpClientImpl |
start()
Start the client.
|
NettyTcpClient<String> |
stop()
Stop the client.
|
boolean |
write(String data)
Write some line of data to the server.
|
boolean |
write(String data,
Object context)
Write some line of data to the server using an acknowledgement mode.
|
connect, getConnectIntervalMs, getConnectRetryIntervalMs, getSslContext, setConnectIntervalMs, setConnectRetryIntervalMs, shutdowngetFileFromString, getSslProviderclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitonActive, onInactive, onThrowablepublic static final String MAX_FRAME_SIZE_KEY
public static final int MAX_FRAME_SIZE_DEFAULT_VALUE
public NettyHttpClientImpl(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,
INettyTuple<Map<String,Object>> in)
onReceive in interface INettyReaderCallback<Map<String,Object>>ctx - the receiving channel context .in - the received data.public boolean write(String data) throws NettyException
NettyTcpClientwrite in interface NettyTcpClient<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(String data, Object context)
NettyTcpClientwrite in interface NettyTcpClient<String>data - the data to sendcontext - some opaque context you need for the ack or fail callback.public NettyHttpClientImpl start()
NettyTcpClientstart in interface NettyTcpClient<String>public NettyTcpClient<String> stop()
NettyTcpClientstop in interface NettyTcpClient<String>public NettyTcpClient<String> setConnectionCallback(INettyConnectionCallback cb)
NettyTcpClientIt can be null and will have no effect.
setConnectionCallback in interface NettyTcpClient<String>cb - the user callbackpublic NettyTcpClient<String> setCallback(INettyReaderCallback<Map<String,Object>> callback)
public NettyTcpClient<String> setName(String name)
NettyTcpClientsetName in interface NettyTcpClient<String>name - the client nameCopyright © 2023. All rights reserved.