public class AsynchronousQueueSubscriberBioImpl extends BigpipeSessionSupport implements AsynchronousQueueSubscriber
BigpipeSessionSupport.PIPE_TYPElifeController, pipeRuntime, reciever| 构造器和说明 |
|---|
AsynchronousQueueSubscriberBioImpl() |
| 限定符和类型 | 方法和说明 |
|---|---|
protected void |
continueConfig(BigPipeConf conf)
继续应用配置信息,允许子类从
BigPipeConf获取私有配置信息并应用 |
BigPipeConf |
getBigPipeConf() |
MessageBodyConverter |
getBodyConverter() |
PipeletIdAwareBigpipeMessageListener |
getMessageListener() |
Receiver |
getReciever() |
TransportStrategy |
getTransStrategy() |
protected void |
handleFastFailed(boolean needBlocking)
发送或者订阅失败时,快速失败处理
|
protected InetAddress |
lookupAddr(NameService ns,
String queueName)
从zk中根据pipeletName获取实例地址
|
protected SessionSocketStream |
openStream(InetAddress addr,
SocketConf conf)
这个openStream是打开关于queue的连接地址
|
protected void |
safeCloseTcpConnect()
关闭socket
|
McpackCommand |
sendAcknowledgement(QueueMessage message,
boolean isFake)
一般不建议直接使用此方法,可以使用acknowlegeXXX的方法
用于向queuesvr回复指定消息的ack报文,服务端将移除此消息(消费掉)
|
void |
setBigPipeConf(BigPipeConf bigPipeConf) |
void |
setBodyConverter(MessageBodyConverter bodyConverter) |
void |
setQueueListener(PipeletIdAwareBigpipeMessageListener messageListener) |
void |
setReciever(Receiver reciever) |
void |
setTransStrategy(TransportStrategy transStrategy) |
void |
shutDown()
关闭订阅
|
void |
start(BigPipeConf conf)
开启selector.select线程
|
void |
startSubscribe()
开启以线程,发送订阅指令后,自动接收消息,并调用
QueueListener
进行消费 |
protected void |
waitingForConnect(int cnt)
连接bigpipe失败时线程等待
|
buildConnect, getPipeletOrQueueName, getType, init, setTypepublic Receiver getReciever()
public void setReciever(Receiver reciever)
public TransportStrategy getTransStrategy()
public void setTransStrategy(TransportStrategy transStrategy)
public PipeletIdAwareBigpipeMessageListener getMessageListener()
public void setQueueListener(PipeletIdAwareBigpipeMessageListener messageListener)
public MessageBodyConverter getBodyConverter()
public void setBodyConverter(MessageBodyConverter bodyConverter)
public BigPipeConf getBigPipeConf()
public void setBigPipeConf(BigPipeConf bigPipeConf)
public void startSubscribe()
AsynchronousQueueSubscriberQueueListener
进行消费startSubscribe 在接口中 AsynchronousQueueSubscriberpublic void shutDown()
AsynchronousQueueSubscribershutDown 在接口中 AsynchronousQueueSubscriberprotected void continueConfig(BigPipeConf conf)
BigpipeSessionSupportBigPipeConf获取私有配置信息并应用continueConfig 在类中 BigpipeSessionSupportconf - BigPipeConf 配置信息public McpackCommand sendAcknowledgement(QueueMessage message, boolean isFake) throws IOException
一般不建议直接使用此方法,可以使用acknowlegeXXX的方法
用于向queuesvr回复指定消息的ack报文,服务端将移除此消息(消费掉)
message - 需要确认消费的消息对象isFake - 如果为true,则服务端接下来将进行fake行为(停止推送)IOExceptionpublic void start(BigPipeConf conf)
start 在类中 BigpipeSessionSupportconf - BigPipeConf 对象,配置信息protected void waitingForConnect(int cnt)
waitingForConnect 在类中 BigpipeSessionSupportcnt - 已经重试的次数protected SessionSocketStream openStream(InetAddress addr, SocketConf conf) throws IOException
openStream 在类中 BigpipeSessionSupportaddr - InetAddress地址conf - SocketConf网络相关配置IOExceptionprotected InetAddress lookupAddr(NameService ns, String queueName) throws NameResolveException, org.apache.zookeeper.KeeperException, QueueLocateException
BigpipeSessionSupportlookupAddr 在类中 BigpipeSessionSupportns - NameService对象queueName - pipelet Name or queue NameInetAddressNameResolveException - 根据名字解析TopicAddress QueueAddress异常org.apache.zookeeper.KeeperException - zk异常QueueLocateExceptionprotected void handleFastFailed(boolean needBlocking)
BigpipeSessionSupporthandleFastFailed 在类中 BigpipeSessionSupportneedBlocking - 是否堵塞其他客户端操作,比如不能够再发布消息protected void safeCloseTcpConnect()
safeCloseTcpConnect 在类中 BigpipeSessionSupportCopyright © 2017. All rights reserved.