public abstract class SubscribeResponseHandler extends AbstractResponseHandler
MessageHandler
and sent consume messages
back to hub servers.cfg, channelManager
Modifier | Constructor and Description |
---|---|
protected |
SubscribeResponseHandler(ClientConfiguration cfg,
HChannelManager channelManager) |
Modifier and Type | Method and Description |
---|---|
abstract void |
asyncCloseSubscription(TopicSubscriber topicSubscriber,
Callback<PubSubProtocol.ResponseBody> callback,
Object context)
Close subscription from this handler.
|
protected abstract void |
asyncMessageDeliver(TopicSubscriber topicSubscriber,
PubSubProtocol.Message message)
Method called when a message arrives for a subscribe Channel and we want
to deliver it asynchronously via the registered MessageHandler (should
not be null when called here).
|
abstract void |
consume(TopicSubscriber topicSubscriber,
PubSubProtocol.MessageSeqId messageSeqId)
Consume a given message for given topic subscriber thru this handler.
|
abstract void |
handleSubscribeMessage(PubSubProtocol.PubSubResponse response)
Handle Message delivered by the server.
|
abstract void |
handleSubscriptionEvent(com.google.protobuf.ByteString topic,
com.google.protobuf.ByteString subscriberId,
PubSubProtocol.SubscriptionEvent event)
Handle a subscription event delivered by the server.
|
abstract boolean |
hasSubscription(TopicSubscriber topicSubscriber)
Whether the given topic subscriber subscribed thru this handler.
|
protected abstract void |
messageConsumed(TopicSubscriber topicSubscriber,
PubSubProtocol.Message message)
Method called when the client app's MessageHandler has asynchronously
completed consuming a subscribed message sent from the server.
|
abstract void |
onChannelDisconnected(InetSocketAddress host,
org.jboss.netty.channel.Channel channel)
This method is called when the underlying channel is disconnected due to server failure.
|
abstract void |
startDelivery(TopicSubscriber topicSubscriber,
MessageHandler messageHandler)
Start delivering messages for a given topic subscriber.
|
abstract void |
stopDelivery(TopicSubscriber topicSubscriber)
Stop delivering messages for a given topic subscriber.
|
handleRedirectResponse, handleResponse
protected SubscribeResponseHandler(ClientConfiguration cfg, HChannelManager channelManager)
public abstract void handleSubscribeMessage(PubSubProtocol.PubSubResponse response)
response
- Message received from the server.public abstract void handleSubscriptionEvent(com.google.protobuf.ByteString topic, com.google.protobuf.ByteString subscriberId, PubSubProtocol.SubscriptionEvent event)
topic
- Topic NamesubscriberId
- Subscriber Idevent
- Subscription Event describes its statusprotected abstract void asyncMessageDeliver(TopicSubscriber topicSubscriber, PubSubProtocol.Message message)
message
- Message from Subscribe Channel we want to consume.protected abstract void messageConsumed(TopicSubscriber topicSubscriber, PubSubProtocol.Message message)
topicSubscriber
- Topic Subscribermessage
- Message sent from server for topic subscription that has been
consumed by the client.public abstract void startDelivery(TopicSubscriber topicSubscriber, MessageHandler messageHandler) throws PubSubException.ClientNotSubscribedException, AlreadyStartDeliveryException
topicSubscriber
- Topic SubscribermessageHandler
- MessageHandler to register for this ResponseHandler instance.PubSubException.ClientNotSubscribedException
- If the client is not currently subscribed to the topicAlreadyStartDeliveryException
- If someone started delivery a message handler before stopping existed one.public abstract void stopDelivery(TopicSubscriber topicSubscriber) throws PubSubException.ClientNotSubscribedException
topicSubscriber
- Topic SubscriberPubSubException.ClientNotSubscribedException
- If the client is not currently subscribed to the topicpublic abstract boolean hasSubscription(TopicSubscriber topicSubscriber)
topicSubscriber
- Topic Subscriberpublic abstract void asyncCloseSubscription(TopicSubscriber topicSubscriber, Callback<PubSubProtocol.ResponseBody> callback, Object context)
topicSubscriber
- Topic Subscribercallback
- Callback when the subscription is closed.context
- Callback context.public abstract void consume(TopicSubscriber topicSubscriber, PubSubProtocol.MessageSeqId messageSeqId)
topicSubscriber
- Topic Subscriberpublic abstract void onChannelDisconnected(InetSocketAddress host, org.jboss.netty.channel.Channel channel)
host
- Host that channel connected to has disconnected.channel
- Channel connected to.Copyright © 2011–2019 The Apache Software Foundation. All rights reserved.