public class ActiveSubscriber extends Object
Modifier and Type | Field and Description |
---|---|
protected ClientConfiguration |
cfg |
protected org.jboss.netty.channel.Channel |
channel |
protected AbstractHChannelManager |
channelManager |
protected HChannel |
hChannel |
protected PubSubData |
op |
protected PubSubProtocol.SubscriptionPreferences |
preferences |
protected TopicSubscriber |
topicSubscriber |
Constructor and Description |
---|
ActiveSubscriber(ClientConfiguration cfg,
AbstractHChannelManager channelManager,
TopicSubscriber ts,
PubSubData op,
PubSubProtocol.SubscriptionPreferences preferences,
org.jboss.netty.channel.Channel channel,
HChannel hChannel)
Construct an active subscriber instance.
|
Modifier and Type | Method and Description |
---|---|
void |
asyncMessageDeliver(PubSubProtocol.Message message)
Deliver message to the client.
|
void |
consume(PubSubProtocol.MessageSeqId messageSeqId)
Consume a specific message.
|
PubSubData |
getPubSubData() |
TopicSubscriber |
getTopicSubscriber() |
void |
handleMessage(PubSubProtocol.Message message)
Handle received message.
|
void |
messageConsumed(PubSubProtocol.Message message)
Application acked to consume message.
|
void |
resubscribeIfNecessary(PubSubProtocol.SubscriptionEvent event)
Resubscribe a subscriber if necessary.
|
void |
startDelivery(MessageHandler messageHandler)
Start delivering messages using given message handler.
|
void |
stopDelivery()
Stop delivering messages to the subscriber.
|
protected void |
unsafeDeliverMessage(PubSubProtocol.Message message)
Unsafe version to deliver message to a message handler.
|
protected final ClientConfiguration cfg
protected final AbstractHChannelManager channelManager
protected final TopicSubscriber topicSubscriber
protected final PubSubData op
protected final PubSubProtocol.SubscriptionPreferences preferences
protected final org.jboss.netty.channel.Channel channel
protected final HChannel hChannel
public ActiveSubscriber(ClientConfiguration cfg, AbstractHChannelManager channelManager, TopicSubscriber ts, PubSubData op, PubSubProtocol.SubscriptionPreferences preferences, org.jboss.netty.channel.Channel channel, HChannel hChannel)
cfg
- Client configuration object.channelManager
- Channel manager instance.ts
- Topic subscriber.op
- Pub/Sub request.preferences
- Subscription preferences for the subscriber.channel
- Netty channel the subscriber lived.public PubSubData getPubSubData()
public TopicSubscriber getTopicSubscriber()
public void startDelivery(MessageHandler messageHandler) throws AlreadyStartDeliveryException, PubSubException.ClientNotSubscribedException
messageHandler
- Message handler to deliver messagesAlreadyStartDeliveryException
- if someone already started delivery.PubSubException.ClientNotSubscribedException
- when start delivery before subscribe.public void stopDelivery()
public void handleMessage(PubSubProtocol.Message message)
message
- Received message.public void asyncMessageDeliver(PubSubProtocol.Message message)
message
- Message to deliver.protected void unsafeDeliverMessage(PubSubProtocol.Message message)
message
- Message to deliver.public void consume(PubSubProtocol.MessageSeqId messageSeqId)
messageSeqId
- Message seq id.public void messageConsumed(PubSubProtocol.Message message)
message
- Message consumed by application.public void resubscribeIfNecessary(PubSubProtocol.SubscriptionEvent event)
event
- Subscription Event.Copyright © 2015 The Apache Software Foundation. All rights reserved.