public class HandlerPublisher<T>
extends io.netty.channel.ChannelDuplexHandler
implements org.reactivestreams.Publisher<T>
| Constructor and Description |
|---|
HandlerPublisher(io.netty.util.concurrent.EventExecutor executor,
Class<? extends T> subscriberMessageType)
Create a handler publisher.
|
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
acceptInboundMessage(Object msg)
Returns
true if the given message should be handled. |
protected void |
cancelled()
Override to handle when a subscriber cancels the subscription.
|
void |
channelActive(io.netty.channel.ChannelHandlerContext ctx) |
void |
channelInactive(io.netty.channel.ChannelHandlerContext ctx) |
void |
channelRead(io.netty.channel.ChannelHandlerContext ctx,
Object message) |
void |
channelReadComplete(io.netty.channel.ChannelHandlerContext ctx) |
void |
channelRegistered(io.netty.channel.ChannelHandlerContext ctx) |
void |
exceptionCaught(io.netty.channel.ChannelHandlerContext ctx,
Throwable cause) |
void |
handlerAdded(io.netty.channel.ChannelHandlerContext ctx) |
void |
handlerRemoved(io.netty.channel.ChannelHandlerContext ctx) |
protected void |
requestDemand()
Override to intercept when demand is requested.
|
void |
subscribe(org.reactivestreams.Subscriber<? super T> subscriber) |
bind, close, connect, deregister, disconnect, flush, read, writepublic HandlerPublisher(io.netty.util.concurrent.EventExecutor executor,
Class<? extends T> subscriberMessageType)
executor - The executor to execute asynchronous events from the subscriber on.subscriberMessageType - The type of message this publisher accepts.protected boolean acceptInboundMessage(Object msg) throws Exception
true if the given message should be handled. If false it will be passed to the next
ChannelInboundHandler in the ChannelPipeline.msg - The message to check.Exceptionprotected void cancelled()
protected void requestDemand()
public void subscribe(org.reactivestreams.Subscriber<? super T> subscriber)
subscribe in interface org.reactivestreams.Publisher<T>public void handlerAdded(io.netty.channel.ChannelHandlerContext ctx)
throws Exception
handlerAdded in interface io.netty.channel.ChannelHandlerhandlerAdded in class io.netty.channel.ChannelHandlerAdapterExceptionpublic void channelRegistered(io.netty.channel.ChannelHandlerContext ctx)
throws Exception
channelRegistered in interface io.netty.channel.ChannelInboundHandlerchannelRegistered in class io.netty.channel.ChannelInboundHandlerAdapterExceptionpublic void channelActive(io.netty.channel.ChannelHandlerContext ctx)
throws Exception
channelActive in interface io.netty.channel.ChannelInboundHandlerchannelActive in class io.netty.channel.ChannelInboundHandlerAdapterExceptionpublic void channelRead(io.netty.channel.ChannelHandlerContext ctx,
Object message)
throws Exception
channelRead in interface io.netty.channel.ChannelInboundHandlerchannelRead in class io.netty.channel.ChannelInboundHandlerAdapterExceptionpublic void channelReadComplete(io.netty.channel.ChannelHandlerContext ctx)
throws Exception
channelReadComplete in interface io.netty.channel.ChannelInboundHandlerchannelReadComplete in class io.netty.channel.ChannelInboundHandlerAdapterExceptionpublic void channelInactive(io.netty.channel.ChannelHandlerContext ctx)
throws Exception
channelInactive in interface io.netty.channel.ChannelInboundHandlerchannelInactive in class io.netty.channel.ChannelInboundHandlerAdapterExceptionpublic void handlerRemoved(io.netty.channel.ChannelHandlerContext ctx)
throws Exception
handlerRemoved in interface io.netty.channel.ChannelHandlerhandlerRemoved in class io.netty.channel.ChannelHandlerAdapterExceptionpublic void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx,
Throwable cause)
throws Exception
exceptionCaught in interface io.netty.channel.ChannelHandlerexceptionCaught in interface io.netty.channel.ChannelInboundHandlerexceptionCaught in class io.netty.channel.ChannelInboundHandlerAdapterExceptionCopyright © 2023. All rights reserved.