Skip navigation links

Package org.apache.hedwig.client.netty

A Netty based Hedwig client implementation.

See: Description

Package org.apache.hedwig.client.netty Description

A Netty based Hedwig client implementation.

Components

The netty based implementation contains following components:

Main Flow

HChannel

Two kinds of HChannels provided in current implementation. HChannelImpl provides the ability to multiplex pub/sub requests in an underlying netty Channel, while DefaultServerChannel provides the ability to establish a netty channel Channel for a pub/sub request. After the underlying netty channel is estabilished, it would be converted into a HChannelImpl by HChannelManager#submitOpThruChannel(pubSubData, channel). Although HChannelImpl provides multiplexing ability, it still could be used for one-channel-per-subscription case, which just sent only one subscribe request thru the underlying channel.

HChannelHandler

HChannelHandler is generic netty ChannelHandler, which handles events from the underlying channel. A HChannelHandler is bound with a HChannel as channel pipeplien when the underlying channel is established. It takes the responsibility of dispatching response to target response handler. For a non-subscription channel, it just handles PUBLISH and UNSUBSCRIBE responses. For a subscription channel, it handles SUBSCRIBE response. For consume requests, we treated them in a fire-and-forget way, so they are not need to be handled by any response handler.

HChannelManager

HChannelManager manages all outstanding connections to target hub servers for a client. Since a subscription channel acts quite different from a non-subscription channel, the basic implementation AbstractHChannelManager manages non-subscription channels and subscription channels in different channel sets. Currently hedwig client provides SimpleHChannelManager which manages subscription channels in one-channel-per-subscription way. In future, if we want to multiplex multiple subscriptions in one channel, we just need to provide an multiplexing version of AbstractHChannelManager which manages channels in multiplexing way, and a multiplexing version of SubscribeResponseHandler which handles multiple subscriptions in one channel.
Skip navigation links

Copyright © 2011–2017 The Apache Software Foundation. All rights reserved.