Class NettyTransport

java.lang.Object
org.graylog2.plugin.inputs.transports.NettyTransport
All Implemented Interfaces:
Transport
Direct Known Subclasses:
AbstractTcpTransport, UdpTransport

public abstract class NettyTransport extends Object implements Transport
  • Field Details

  • Constructor Details

  • Method Details

    • getChannelInitializer

      protected io.netty.channel.ChannelInitializer<? extends io.netty.channel.Channel> getChannelInitializer(LinkedHashMap<String,Callable<? extends io.netty.channel.ChannelHandler>> handlerList)
    • getLocalAddress

      @Nullable public abstract SocketAddress 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

      public void setMessageAggregator(@Nullable CodecAggregator aggregator)
      Specified by:
      setMessageAggregator in interface Transport
    • getAggregator

      @Nullable protected CodecAggregator getAggregator()
    • getChannelHandlers

      protected LinkedHashMap<String,Callable<? extends io.netty.channel.ChannelHandler>> getChannelHandlers(MessageInput input)
      Subclasses can override this to add additional channel handlers to the Netty ChannelPipeline to support additional features. Some common use cases are to add connection counters or traffic shapers.
      Parameters:
      input - The MessageInput for which these channel handlers are being added
      Returns:
      list of initial channel handlers to add to the Netty channel pipeline
    • getCustomChildChannelHandlers

      protected LinkedHashMap<String,Callable<? extends io.netty.channel.ChannelHandler>> getCustomChildChannelHandlers(MessageInput input)
      Subclasses can override this to modify the channel handlers at the end of the pipeline for child channels.
      Parameters:
      input - The MessageInput for which these child channel handlers are being added
      Returns:
      list of custom channel handlers to add to the Netty channel pipeline for child channels
    • getChildChannelHandlers

      protected abstract LinkedHashMap<String,Callable<? extends io.netty.channel.ChannelHandler>> getChildChannelHandlers(MessageInput input)
      Subclasses can override this to modify the channel handlers for child channels. The default handlers in this group are all channel handlers returned by getCustomChildChannelHandlers(MessageInput), the optional aggregation handler (e.g. for chunked GELF via UDP) and the RawMessageHandler (in that order). Usually overriding this method should only be necessary if you have a codec that cannot create a RawMessage 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 - The MessageInput for which these child channel handlers are being added
      Returns:
      list of custom channel handlers to add to the Netty channel pipeline for child channels
      See Also:
    • getRecvBufferSize

      protected int getRecvBufferSize()
    • getMetricSet

      public com.codahale.metrics.MetricSet getMetricSet()
      Specified by:
      getMetricSet in interface Transport