[ https://issues.apache.org/jira/browse/BOOKKEEPER-252?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13451740#comment-13451740 ]
Sijie Guo commented on BOOKKEEPER-252: -------------------------------------- first of all, I have to clarify that disabling reconnect logic is necessary. if a subscriber subscribes with 'forceAttach', it would kill the existed attached subscription. the killed subscription would reconnect and kill the new one if we couldn't disable reconnect logic. so it would enter a killing-loop for the subscribers. after disabling reconnect logic, we need some mechanism to get application notified with the events of the channel(the channel is broken due to hub failure, due to topic periodical release or other things). otherwise, application would not notice that it could not receive messages any more due to something is wrong. so SubscriptionChannelListener is the mechanism we needed when enabling 'forceAttach'. {quote} alternatively merge it with MessageHandler, {quote} It is not only a BC break when merging it with MessageHandler. MessageHandler is just used to receive notifications, which is quite different to a listener on the events of a subscription channel. Because, application could start or stop a message handler according to its usage. I would have a use case to explain that. Say a proxy server using a hedwig client to receive notifications from hub server and send to its downstream servers. A proxy server may #stopDelivery after receiving N messages from hub, which is to send these messages to its downstream and wait for their responses. If the connection to hub server is broken now, the proxy server would not get notified with it, since the message handler has been #stopDelivery. it just only get notified when it called #startDelivery, which might be a long delay. Bad thing is that a new message handler might be used calling #startDelivery. {quote} I think it would be better to register it with the Subscriber as a whole, if it is indeed needed. {quote} You are forcing all subscriptions for this subscriber to use same one. But different subscriptions has different behaviors. So I would prefer it would be subscription-level not client-level. > Hedwig: provide a subscription mode to kill other subscription channel when > hedwig client is used as a proxy-style server. > -------------------------------------------------------------------------------------------------------------------------- > > Key: BOOKKEEPER-252 > URL: https://issues.apache.org/jira/browse/BOOKKEEPER-252 > Project: Bookkeeper > Issue Type: New Feature > Affects Versions: 4.1.0 > Reporter: Sijie Guo > Assignee: Sijie Guo > Fix For: 4.2.0 > > Attachments: BK-252.diff, BOOKKEEPER-252.diff, BOOKKEEPER-252.diff > > > In some case, we need to hedwig-client as proxy server to provide messaging > service to other users. > client -> proxy server 1 -> hedwig > \> proxy server 2 /> > when client would connect to either proxy server to receive messages, the > proxy server would setup subscription channel to hedwig server. > we just want client to be simple, so when the channel between client and > proxy server is broken, client will try to connect to proxy servers thru VIP. > it might connect to other proxy server. for example, first time client > connects to proxy server 1, but the client found the connection is broken, it > connects to proxy server 2. when proxy server 2 tried to setup subscription > channel to hedwig, hedwig found that this subscription has existed before > occupied by proxy server 1. > the panic here is that proxy server 1 only disconnect old subscription > channel only when it detected the channel between client and itself is > broken. The detection might be delayed due to several reasons. so it might > increment the latency that messages are pushed to real client. > so we try to introduce a subscription mode called CREATE_OR_ATTACH_OR_KILL > mode. > when a subscriber use this subscription mode, it would kill old existed > subscription channel. when using this subscription mode, we would turn off > auto-reconnect functionality in hedwig client and just tell client about the > channel disconnected event so client could do its logic when channel is > detected. > in order to provide some admin tool for admin guys to debug/operate, we > provide ADMIN mode. if a subscriber attach to a subscription using ADMIN > mode, its subscription channel would never be killed, then it is safe to > guarantee admin operations. > -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira