Has anyone been able to set up a reactor-netty tcp server with a 
configurable pipeline. It seems that I have to call newHandler that takes a 
functional interface, a BiFunction handler with NettyInbound and OutBlound. 
Returning anything from the handler results in a response to the client but 
nothing goes through the pipeline. The pipeline can be set after creating 
the TcpServer with afterChannelInit.

EventLoopGroup group = new NioEventLoopGroup(1);
    try {
        final TcpServer server = TcpServer.create(opts -> opts.
afterChannelInit(clientEndPoint).listen(tcpSocketAddress));
        server.newHandler((in, out) -> {
            in.receive().asByteArray().map(bb -> {
                try {
                    return m.readValue(bb, Message.class);
                } catch (IOException io) {
                    throw Exceptions.propagate(io);
                }
            }).log("conn").subscribe(data -> {
                if ("Hello World!".equals(data.getMessage())) {
                    latch.countDown();
                }
            });
            return Flux.never();//does not return anything to client or 
even pass the event to the pipeline
            //this returns to the client: return 
out.sendString(Mono.just("Hi")).neverComplete();
        }).block(Duration.ofSeconds(30));
    } finally {
        group.shutdownGracefully().sync();
    }

I don't want to return anything to the client until it has gone through the 
pipeline.
My clientEndPoint implements Consumer<Channel> and sets up the pipeline in 
the accept(Channel sc) method.
The above is structured from Netty-reactor's 
tcpServerHandlesJsonPojosOverSsl 
<https://github.com/reactor/reactor-netty/blob/master/src/test/java/reactor/ipc/netty/tcp/TcpServerTests.java>

thanks

Phillip

-- 
You received this message because you are subscribed to the Google Groups 
"Netty discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/netty/f5c54252-b662-4c4d-9a2d-5b00ac49ba0a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to