Package reactor.net.encoding.syslog

Examples of reactor.net.encoding.syslog.SyslogCodec$SyslogMessageDecoder


       public void initChannel(SocketChannel ch) throws Exception {
         ChannelPipeline pipeline = ch.pipeline();
         pipeline.addLast("framer", new DelimiterBasedFrameDecoder(8192, Delimiters.lineDelimiter()));
         pipeline.addLast("decoder", new StringDecoder());
         pipeline.addLast("syslogDecoder", new MessageToMessageDecoder<String>() {
           Function<Buffer, SyslogMessage> decoder = new SyslogCodec().decoder(null);

           @Override
           public void decode(ChannelHandlerContext ctx, String msg, List<Object> messages) throws Exception {
             messages.add(decoder.apply(Buffer.wrap(msg + "\n")));
           }
View Full Code Here


    TcpServer<SyslogMessage, Void> server = new TcpServerSpec<SyslogMessage, Void>(NettyTcpServer.class)
        .env(env)
            //.using(SynchronousDispatcher.INSTANCE)
            //.dispatcher(Environment.RING_BUFFER_GROUP)
        .dispatcher(Environment.RING_BUFFER)
        .codec(new SyslogCodec())
        .consume(new Consumer<NetChannel<SyslogMessage, Void>>() {
          @Override
          public void accept(NetChannel<SyslogMessage, Void> conn) {
            conn
                .consume(new Consumer<SyslogMessage>() {
View Full Code Here

    } else {
      spec = new TcpServerSpec<Buffer, Buffer>(NettyTcpServer.class);
    }

    // this is faster than putting the codec directly on the server
    final Function<Buffer, SyslogMessage> decoder = new SyslogCodec()
        .decoder(new Consumer<SyslogMessage>() {

          @Override
          public void accept(SyslogMessage syslogMsg) {
            Map<String, Object> m = new LinkedHashMap<String, Object>();
View Full Code Here

TOP

Related Classes of reactor.net.encoding.syslog.SyslogCodec$SyslogMessageDecoder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.