Class NettyTransport
java.lang.Object
org.graylog2.plugin.inputs.transports.NettyTransport
- All Implemented Interfaces:
Transport
- Direct Known Subclasses:
AbstractTcpTransport,UdpTransport
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.graylog2.plugin.inputs.transports.Transport
Transport.Factory<T extends Transport> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringprotected final EventLoopGroupFactoryprotected final com.codahale.metrics.MetricRegistryprotected final InetSocketAddressprotected final ThroughputCounterprotected final int -
Constructor Summary
ConstructorsConstructorDescriptionNettyTransport(Configuration configuration, EventLoopGroupFactory eventLoopGroupFactory, ThroughputCounter throughputCounter, LocalMetricRegistry localRegistry) -
Method Summary
Modifier and TypeMethodDescriptionprotected CodecAggregatorprotected LinkedHashMap<String,Callable<? extends io.netty.channel.ChannelHandler>> getChannelHandlers(MessageInput input) Subclasses can override this to add additionalchannel handlersto the NettyChannelPipelineto 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 handlersfor child channels.protected LinkedHashMap<String,Callable<? extends io.netty.channel.ChannelHandler>> Subclasses can override this to modify thechannel handlersat the end of the pipeline for child channels.abstract SocketAddressGet the local socket address this transport is listening on after being launched.com.codahale.metrics.MetricSetprotected intvoidsetMessageAggregator(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
nullif the transport hasn't been launched yet.
-
setMessageAggregator
- Specified by:
setMessageAggregatorin interfaceTransport
-
getAggregator
-
getChannelHandlers
protected LinkedHashMap<String,Callable<? extends io.netty.channel.ChannelHandler>> getChannelHandlers(MessageInput input) Subclasses can override this to add additionalchannel handlersto the NettyChannelPipelineto support additional features. Some common use cases are to add connection counters or traffic shapers.- Parameters:
input- TheMessageInputfor which these channel handlers are being added- Returns:
- list of initial
channel handlersto 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 handlersat the end of the pipeline for child channels.- Parameters:
input- TheMessageInputfor which these child channel handlers are being added- Returns:
- list of custom
channel handlersto add to the Nettychannel pipelinefor child channels
-
getChildChannelHandlers
protected abstract LinkedHashMap<String,Callable<? extends io.netty.channel.ChannelHandler>> getChildChannelHandlers(MessageInput input) Subclasses can override this to modify thechannel handlersfor 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 aRawMessagefor 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- TheMessageInputfor which these child channel handlers are being added- Returns:
- list of custom
channel handlersto add to the Nettychannel pipelinefor child channels - See Also:
-
getRecvBufferSize
protected int getRecvBufferSize() -
getMetricSet
public com.codahale.metrics.MetricSet getMetricSet()- Specified by:
getMetricSetin interfaceTransport
-