Class NettyEventSender<T>

java.lang.Object
org.apache.nifi.event.transport.netty.NettyEventSender<T>
Type Parameters:
T - Event Type
All Implemented Interfaces:
AutoCloseable, EventSender<T>

class NettyEventSender<T> extends Object implements EventSender<T>
Netty Event Sender with Channel Pool
  • Field Details

    • group

      private final io.netty.channel.EventLoopGroup group
    • channelPool

      private final io.netty.channel.pool.ChannelPool channelPool
    • remoteAddress

      private final SocketAddress remoteAddress
    • singleEventPerConnection

      private final boolean singleEventPerConnection
    • shutdownQuietPeriod

      private final Duration shutdownQuietPeriod
    • shutdownTimeout

      private final Duration shutdownTimeout
  • Constructor Details

    • NettyEventSender

      NettyEventSender(io.netty.channel.EventLoopGroup group, io.netty.channel.pool.ChannelPool channelPool, SocketAddress remoteAddress, boolean singleEventPerConnection)
      Netty Channel Event Sender with Event Loop Group and Channel Pool
      Parameters:
      group - Event Loop Group
      channelPool - Channel Pool
      remoteAddress - Remote Address
      singleEventPerConnection - If true, send a single event per connection, and then close it.
    • NettyEventSender

      NettyEventSender(io.netty.channel.EventLoopGroup group, io.netty.channel.pool.ChannelPool channelPool, SocketAddress remoteAddress, boolean singleEventPerConnection, Duration shutdownQuietPeriod, Duration shutdownTimeout)
      Netty Channel Event Sender with Event Loop Group, Channel Pool, and Shutdown Configuration
      Parameters:
      group - Event Loop Group
      channelPool - Channel Pool
      remoteAddress - Remote Address
      singleEventPerConnection - If true, send a single event per connection, and then close it.
      shutdownQuietPeriod - server shutdown quiet period
      shutdownTimeout - server shutdown timeout
  • Method Details

    • sendEvent

      public void sendEvent(T event)
      Send Event using Channel acquired from Channel Pool
      Specified by:
      sendEvent in interface EventSender<T>
      Parameters:
      event - Event
    • close

      public void close()
      Close Channel Pool and Event Loop Group
      Specified by:
      close in interface AutoCloseable
    • toString

      public String toString()
      String representation includes Channel Remote Address
      Overrides:
      toString in class Object
      Returns:
      String with Channel Remote Address
    • getChannelMessage

      private String getChannelMessage(String message)
    • releaseChannel

      private void releaseChannel(io.netty.channel.Channel channel)