Class NettyTransport
java.lang.Object
org.graylog2.plugin.inputs.transports.NettyTransport
- All Implemented Interfaces:
Transport
- Direct Known Subclasses:
AbstractTcpTransport
,UdpTransport
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.graylog2.plugin.inputs.transports.Transport
Transport.Factory<T extends Transport>
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
protected final EventLoopGroupFactory
protected final com.codahale.metrics.MetricRegistry
protected final InetSocketAddress
protected final ThroughputCounter
protected final int
-
Constructor Summary
ConstructorDescriptionNettyTransport
(Configuration configuration, EventLoopGroupFactory eventLoopGroupFactory, ThroughputCounter throughputCounter, LocalMetricRegistry localRegistry) -
Method Summary
Modifier and TypeMethodDescriptionprotected CodecAggregator
protected LinkedHashMap<String,
Callable<? extends io.netty.channel.ChannelHandler>> getChannelHandlers
(MessageInput input) Subclasses can override this to add additionalchannel handlers
to the NettyChannelPipeline
to support additional features.protected io.netty.channel.ChannelInitializer<? extends io.netty.channel.Channel>
getChannelInitializer
(LinkedHashMap<String, Callable<? extends io.netty.channel.ChannelHandler>> handlerList) protected abstract LinkedHashMap<String,
Callable<? extends io.netty.channel.ChannelHandler>> Subclasses can override this to modify thechannel handlers
for child channels.protected LinkedHashMap<String,
Callable<? extends io.netty.channel.ChannelHandler>> Subclasses can override this to modify thechannel handlers
at the end of the pipeline for child channels.abstract SocketAddress
Get the local socket address this transport is listening on after being launched.com.codahale.metrics.MetricSet
protected int
void
setMessageAggregator
(CodecAggregator aggregator)
-
Field Details
-
CK_BIND_ADDRESS
- See Also:
-
CK_PORT
- See Also:
-
CK_RECV_BUFFER_SIZE
- See Also:
-
CK_NUMBER_WORKER_THREADS
- See Also:
-
eventLoopGroupFactory
-
localRegistry
protected final com.codahale.metrics.MetricRegistry localRegistry -
socketAddress
-
throughputCounter
-
workerThreads
protected final int workerThreads
-
-
Constructor Details
-
NettyTransport
public NettyTransport(Configuration configuration, EventLoopGroupFactory eventLoopGroupFactory, ThroughputCounter throughputCounter, LocalMetricRegistry localRegistry)
-
-
Method Details
-
getChannelInitializer
protected io.netty.channel.ChannelInitializer<? extends io.netty.channel.Channel> getChannelInitializer(LinkedHashMap<String, Callable<? extends io.netty.channel.ChannelHandler>> handlerList) -
getLocalAddress
Get the local socket address this transport is listening on after being launched.- Returns:
- the listening address of this transport or
null
if the transport hasn't been launched yet.
-
setMessageAggregator
- Specified by:
setMessageAggregator
in interfaceTransport
-
getAggregator
-
getChannelHandlers
protected LinkedHashMap<String,Callable<? extends io.netty.channel.ChannelHandler>> getChannelHandlers(MessageInput input) Subclasses can override this to add additionalchannel handlers
to the NettyChannelPipeline
to support additional features. Some common use cases are to add connection counters or traffic shapers.- Parameters:
input
- TheMessageInput
for which these channel handlers are being added- Returns:
- list of initial
channel handlers
to add to the Nettychannel pipeline
-
getCustomChildChannelHandlers
protected LinkedHashMap<String,Callable<? extends io.netty.channel.ChannelHandler>> getCustomChildChannelHandlers(MessageInput input) Subclasses can override this to modify thechannel handlers
at the end of the pipeline for child channels.- Parameters:
input
- TheMessageInput
for which these child channel handlers are being added- Returns:
- list of custom
channel handlers
to add to the Nettychannel pipeline
for child channels
-
getChildChannelHandlers
protected abstract LinkedHashMap<String,Callable<? extends io.netty.channel.ChannelHandler>> getChildChannelHandlers(MessageInput input) Subclasses can override this to modify thechannel handlers
for child channels. The default handlers in this group are all channel handlers returned bygetCustomChildChannelHandlers(MessageInput)
, the optional aggregation handler (e.g. for chunked GELF via UDP) and theRawMessageHandler
(in that order). Usually overriding this method should only be necessary if you have a codec that cannot create aRawMessage
for incoming messages at the end of the pipeline. A valid use case would be to insert debug handlers in the middle of the list, though.- Parameters:
input
- TheMessageInput
for which these child channel handlers are being added- Returns:
- list of custom
channel handlers
to add to the Nettychannel pipeline
for child channels - See Also:
-
getRecvBufferSize
protected int getRecvBufferSize() -
getMetricSet
public com.codahale.metrics.MetricSet getMetricSet()- Specified by:
getMetricSet
in interfaceTransport
-