title: How can I use an EventExecutorGroup with an NioDatagramChannel in Netty?
body: <p>I'm new to Netty, but I've worked with NIO a bit recently. 
  I'm building a UDP server, and it seems from the examples I've tried that unlike the <code>NioServerSocketChannel.class</code>, when you use the <code>NioDatagramChannel.class</code> you cannot assign an <code>EventLoopGroup</code> <code>workerGroup</code> to handle the Datagrams once they've been accepted by the socket. My code, based on the Netty <a href="https://github.com/netty/netty/blob/master/example/src/main/java/io/netty/example/qotm/QuoteOfTheMomentServer.java" rel="nofollow">QuoteOfTheMoment server</a> example looks like this: </p>
  
  <pre><code>public class PositionServer {
  
      int port;
  
      public PositionServer(int port) {
          this.port = port;
          System.out.println("Port set to " + this.port);
      }
  
      public void run() {
          EventLoopGroup bossGroup = new NioEventLoopGroup();
  
          try {
  
              Bootstrap bootstrap = new Bootstrap();
              bootstrap.group(bossGroup).channel(NioDatagramChannel.class)
              .handler(new PositionServerHandler());
  
              System.out.println("Binding to port " + port);
              bootstrap.bind(port).sync().channel().closeFuture().await();
  
          } catch (InterruptedException e) {
              bossGroup.shutdownGracefully();
              e.printStackTrace();
          }
      }
  
      public static void main(String[] args) {
  
          new PositionServer(4000).run();
  
      }
  
  }
  </code></pre>
  
  <p>This works perfectly fine, right now the <code>PositionServerHandler</code> simply outputs the messages to the console.</p>
  
  <p>I want to push the messages into a database, they're JSON strings, so I'd like to convert them to JSON first. I don't want to do the in the <code>bossGroup</code> as it'll block with the database accessing and JSON processing. But I can't see an obvious way to add a <code>workerGroup</code>.  </p>
  
  <p>Googling didn't reveal much either, except that my <code>workerGroup</code> in this case should probably be an <code>EventExecutorGroup</code> and not an <code>EventLoopGroup</code>, but I'm not even 100% certain about that.  </p>
  
  <p>In NIO, I would have two thread pools, and I'd use some sort of queue, one pool of threads would push Strings to the queue, the other would take Strings from the queue, convert them to JSON objects and push them to the database.  </p>
  
  <p>Can I do something similar in Netty?  </p>
  
  <p>In which case my <code>PositionServerHandler.class</code> would accept a queue in the constructor, and push either whole <code>DatagramPackets</code> to it, or the message contents, then have another <code>EventLoopGroup</code>/<code>EventExecutorGroup</code> to take those messages and push them to the database. 
  It seems that <code>ServerBootstrap</code> doesn't handle <code>NioDatagramChannels</code> for some reason, that doesn't make sense to me.</p>
  
  <p>Is this feasible? Am I missing some obvious solution to this?</p>