Created
April 16, 2012 12:40
-
-
Save lennartkoopmann/2398518 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected Object decode(ChannelHandlerContext ctx, Channel channel, ChannelBuffer buffer) throws Exception { | |
byte[] readable = new byte[buffer.readableBytes()]; | |
buffer.toByteBuffer().get(readable, 0, buffer.readableBytes()); // I'm 12 years old and what is this? There must be a better way. | |
GELFMessage msg = new GELFMessage(readable); | |
if (msg.getGELFType() == GELFMessage.TYPE_CHUNKED) { | |
// This is a GELF message chunk. Add chunk to manager. | |
server.getGELFChunkManager().insert(msg.asChunk()); // XXX IMPROVE: this msg.asChunk() is a bit bumpy. better have a chunk from the beginning on. | |
} else { | |
// This is a non-chunked/complete GELF message. Process it. | |
processor.messageReceived(msg); | |
} | |
return buffer.readBytes(buffer.readableBytes()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment