Skip to content

Instantly share code, notes, and snippets.

@tsegismont
Created November 4, 2014 22:05
Show Gist options
  • Select an option

  • Save tsegismont/d43d68ef1320df8e5f67 to your computer and use it in GitHub Desktop.

Select an option

Save tsegismont/d43d68ef1320df8e5f67 to your computer and use it in GitHub Desktop.
netty-collectd bootstrap
group = new NioEventLoopGroup();
bootstrap = new Bootstrap();
bootstrap.group(group).channel(NioDatagramChannel.class).handler(new ChannelInitializer<Channel>() {
@Override
protected void initChannel(Channel channel) throws Exception {
ChannelPipeline pipeline = channel.pipeline();
pipeline.addLast(new CollectdPartsDecoder()); // Add CollectdPartsDecoder first
pipeline.addLast(new CollectdEventsDecoder()); // Then CollectdEventsDecoder
pipeline.addLast(new MyCollectdEventHandler()); // Consume events in your own handler
}
}).localAddress(address);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment