public abstract class NettyTransport extends Object implements Transport
Modifier and Type | Class and Description |
---|---|
static class |
NettyTransport.Config |
Transport.Factory<T extends Transport>
Modifier and Type | Field and Description |
---|---|
static String |
CK_BIND_ADDRESS |
static String |
CK_PORT |
static String |
CK_RECV_BUFFER_SIZE |
protected com.codahale.metrics.MetricRegistry |
localRegistry |
protected ThroughputCounter |
throughputCounter |
Constructor and Description |
---|
NettyTransport(Configuration configuration,
ThroughputCounter throughputCounter,
LocalMetricRegistry localRegistry) |
Modifier and Type | Method and Description |
---|---|
protected LinkedHashMap<String,Callable<? extends org.jboss.netty.channel.ChannelHandler>> |
getBaseChannelHandlers(MessageInput input)
Subclasses can override this to add additional ChannelHandlers to the pipeline to support additional features.
|
protected abstract org.jboss.netty.bootstrap.Bootstrap |
getBootstrap()
Construct a
ServerBootstrap to use with this transport. |
protected LinkedHashMap<String,Callable<? extends org.jboss.netty.channel.ChannelHandler>> |
getFinalChannelHandlers(MessageInput input)
Subclasses can override this to modify the
channel handlers at the end of the pipeline. |
SocketAddress |
getLocalAddress()
Get the local socket address this transport is listening on after being launched.
|
com.codahale.metrics.MetricSet |
getMetricSet() |
protected long |
getRecvBufferSize() |
void |
launch(MessageInput input) |
void |
setMessageAggregator(CodecAggregator aggregator) |
void |
stop() |
public static final String CK_BIND_ADDRESS
public static final String CK_PORT
public static final String CK_RECV_BUFFER_SIZE
protected final com.codahale.metrics.MetricRegistry localRegistry
protected final ThroughputCounter throughputCounter
public NettyTransport(Configuration configuration, ThroughputCounter throughputCounter, LocalMetricRegistry localRegistry)
public void setMessageAggregator(@Nullable CodecAggregator aggregator)
setMessageAggregator
in interface Transport
public void launch(MessageInput input) throws MisfireException
launch
in interface Transport
MisfireException
protected abstract org.jboss.netty.bootstrap.Bootstrap getBootstrap()
ServerBootstrap
to use with this transport.
Set all the options on it you need to have, but do not set a ChannelPipelineFactory
, it will be replaced with the
augmented list of handlers returned by getBaseChannelHandlers(org.graylog2.plugin.inputs.MessageInput)
protected LinkedHashMap<String,Callable<? extends org.jboss.netty.channel.ChannelHandler>> getBaseChannelHandlers(MessageInput input)
input
- ChannelPipelineFactory
protected LinkedHashMap<String,Callable<? extends org.jboss.netty.channel.ChannelHandler>> getFinalChannelHandlers(MessageInput input)
channel handlers
at the end of the pipeline.
The default handlers in this group are the aggregation handler (e.g. for chunked GELF via UDP), which can be missing, and the NettyTransport.RawMessageHandler
.
Usually this should not be necessary, only modify them if you have a codec that cannot create a RawMessage
for
incoming messages at the end of the pipeline.
One valid use case would be to insert debug handlers in the middle of the list, though.input
- protected long getRecvBufferSize()
public SocketAddress getLocalAddress()
null
if the transport hasn't been launched yet.public com.codahale.metrics.MetricSet getMetricSet()
getMetricSet
in interface Transport
Copyright © 2012–2018 Graylog, Inc.. All rights reserved.