title: Streaming XML from NetServer in Vert.X
body: <p>I'm trying to get make a Verticle than runs a TcpServer which then reads XML asynchronously from incomming connections, stores all xml it receives into a PriorityQueue and then broadcasts XML messages from the Queue.</p>
  
  <p>I'm using a NetServer that reads incoming data from accepted NetSocket connections, but I don't know how to parse the stream data by xml. If I use the standard handler, which converts Buffer to String, I'm getting cut off messages.
  I've managed to get it mostly working by creating a RecordParser that deliminates by the XML's end tag, but that's more of a band-aid. If I were to get a lot of bad data before the Xml message, that would be included.</p>
  
  <p>When I use straight netty, it has an option for an XMLFrameDecoder which worked, but is there some way to achieve this in Vert.x?</p>
  
  <p>Here's what I have so far</p>
  
  <pre><code>@Override
  public void start(Future&lt;Void&gt; startFuture) {
      NetServerOptions options = new NetServerOptions()
              .setPort(mPort)
              .setTcpKeepAlive(true);
      mServer = vertx.createNetServer(options);
      mServer.connectHandler(new Handler&lt;NetSocket&gt;() {
          @Override
          public void handle(NetSocket netSocket) {
              netSocket.handler(RecordParser.newDelimited("&lt;/root&gt;", new Handler&lt;Buffer&gt;() {
                  @Override
                  public void handle(Buffer buffer) {
                      String xml = buffer.getString(0, buffer.length()) + "&lt;/root&gt;";
                      XMLMessage message = new XMLMessage (xml);
                      System.out.println(xml);
                  }
              }));
          }
      });
      mServer.listen();
  }
  </code></pre>
  
  <p>Let me know if you have any suggestions.</p>