Search in sources :

Example 1 with ExceptionLoggingChannelHandler

use of org.graylog2.inputs.transports.netty.ExceptionLoggingChannelHandler in project graylog2-server by Graylog2.

the class AbstractTcpTransport method getChildChannelHandlers.

@Override
protected LinkedHashMap<String, Callable<? extends ChannelHandler>> getChildChannelHandlers(MessageInput input) {
    final LinkedHashMap<String, Callable<? extends ChannelHandler>> handlers = new LinkedHashMap<>();
    final CodecAggregator aggregator = getAggregator();
    handlers.put("channel-registration", () -> new ChannelRegistrationHandler(childChannels));
    handlers.put("traffic-counter", () -> throughputCounter);
    handlers.put("connection-counter", () -> connectionCounter);
    if (tlsEnable) {
        LOG.info("Enabled TLS for input [{}/{}]. key-file=\"{}\" cert-file=\"{}\"", input.getName(), input.getId(), tlsKeyFile, tlsCertFile);
        handlers.put("tls", getSslHandlerCallable(input));
    }
    handlers.putAll(getCustomChildChannelHandlers(input));
    if (aggregator != null) {
        LOG.debug("Adding codec aggregator {} to channel pipeline", aggregator);
        handlers.put("codec-aggregator", () -> new ByteBufMessageAggregationHandler(aggregator, localRegistry));
    }
    handlers.put("rawmessage-handler", () -> new RawMessageHandler(input));
    handlers.put("exception-logger", () -> new ExceptionLoggingChannelHandler(input, LOG, this.tcpKeepalive));
    return handlers;
}
Also used : CodecAggregator(org.graylog2.plugin.inputs.codecs.CodecAggregator) ExceptionLoggingChannelHandler(org.graylog2.inputs.transports.netty.ExceptionLoggingChannelHandler) ByteBufMessageAggregationHandler(org.graylog2.inputs.transports.netty.ByteBufMessageAggregationHandler) ChannelRegistrationHandler(org.graylog2.inputs.transports.netty.ChannelRegistrationHandler) ChannelHandler(io.netty.channel.ChannelHandler) ExceptionLoggingChannelHandler(org.graylog2.inputs.transports.netty.ExceptionLoggingChannelHandler) Callable(java.util.concurrent.Callable) LinkedHashMap(java.util.LinkedHashMap) RawMessageHandler(org.graylog2.inputs.transports.netty.RawMessageHandler)

Example 2 with ExceptionLoggingChannelHandler

use of org.graylog2.inputs.transports.netty.ExceptionLoggingChannelHandler in project graylog2-server by Graylog2.

the class NettyTransport method getChannelHandlers.

/**
 * Subclasses can override this to add additional {@link ChannelHandler channel handlers} to the
 * Netty {@link ChannelPipeline} to support additional features.
 *
 * Some common use cases are to add connection counters or traffic shapers.
 *
 * @param input The {@link MessageInput} for which these channel handlers are being added
 * @return list of initial {@link ChannelHandler channel handlers} to add to the Netty {@link ChannelPipeline channel pipeline}
 */
protected LinkedHashMap<String, Callable<? extends ChannelHandler>> getChannelHandlers(final MessageInput input) {
    LinkedHashMap<String, Callable<? extends ChannelHandler>> handlerList = new LinkedHashMap<>();
    handlerList.put("exception-logger", () -> new ExceptionLoggingChannelHandler(input, log));
    handlerList.put("packet-meta-dumper", () -> new PacketInformationDumper(input));
    handlerList.put("output-failure-logger", () -> PromiseFailureHandler.INSTANCE);
    return handlerList;
}
Also used : ExceptionLoggingChannelHandler(org.graylog2.inputs.transports.netty.ExceptionLoggingChannelHandler) ChannelHandler(io.netty.channel.ChannelHandler) ExceptionLoggingChannelHandler(org.graylog2.inputs.transports.netty.ExceptionLoggingChannelHandler) PacketInformationDumper(org.graylog2.plugin.inputs.util.PacketInformationDumper) Callable(java.util.concurrent.Callable) LinkedHashMap(java.util.LinkedHashMap)

Aggregations

ChannelHandler (io.netty.channel.ChannelHandler)2 LinkedHashMap (java.util.LinkedHashMap)2 Callable (java.util.concurrent.Callable)2 ExceptionLoggingChannelHandler (org.graylog2.inputs.transports.netty.ExceptionLoggingChannelHandler)2 ByteBufMessageAggregationHandler (org.graylog2.inputs.transports.netty.ByteBufMessageAggregationHandler)1 ChannelRegistrationHandler (org.graylog2.inputs.transports.netty.ChannelRegistrationHandler)1 RawMessageHandler (org.graylog2.inputs.transports.netty.RawMessageHandler)1 CodecAggregator (org.graylog2.plugin.inputs.codecs.CodecAggregator)1 PacketInformationDumper (org.graylog2.plugin.inputs.util.PacketInformationDumper)1