public interface Subscriber
| Modifier and Type | Method and Description |
|---|---|
void |
asyncCloseSubscription(com.google.protobuf.ByteString topic,
com.google.protobuf.ByteString subscriberId,
Callback<Void> callback,
Object context)
Closes all of the client side cached data for this subscription without
actually sending an unsubscribe request to the server.
|
void |
asyncSubscribe(com.google.protobuf.ByteString topic,
com.google.protobuf.ByteString subscriberId,
PubSubProtocol.SubscribeRequest.CreateOrAttach mode,
Callback<Void> callback,
Object context)
Subscribe to the given topic asynchronously for the inputted subscriberId
disregarding if the topic has been created yet or not.
|
void |
asyncUnsubscribe(com.google.protobuf.ByteString topic,
com.google.protobuf.ByteString subscriberId,
Callback<Void> callback,
Object context)
Unsubscribe from a topic asynchronously that the subscriberId user has
previously subscribed to.
|
void |
closeSubscription(com.google.protobuf.ByteString topic,
com.google.protobuf.ByteString subscriberId)
Closes all of the client side cached data for this subscription without
actually sending an unsubscribe request to the server.
|
void |
consume(com.google.protobuf.ByteString topic,
com.google.protobuf.ByteString subscriberId,
PubSubProtocol.MessageSeqId messageSeqId)
Manually send a consume message to the server for the given inputs.
|
List<com.google.protobuf.ByteString> |
getSubscriptionList(com.google.protobuf.ByteString subscriberId)
Fills the input List with the subscriptions this subscriberId client is
subscribed to.
|
boolean |
hasSubscription(com.google.protobuf.ByteString topic,
com.google.protobuf.ByteString subscriberId)
Checks if the subscriberId client is currently subscribed to the given
topic.
|
void |
startDelivery(com.google.protobuf.ByteString topic,
com.google.protobuf.ByteString subscriberId,
MessageHandler messageHandler)
Begin delivery of messages from the server to us for this topic and
subscriberId.
|
void |
stopDelivery(com.google.protobuf.ByteString topic,
com.google.protobuf.ByteString subscriberId)
Stop delivery of messages for this topic and subscriberId.
|
void |
subscribe(com.google.protobuf.ByteString topic,
com.google.protobuf.ByteString subscriberId,
PubSubProtocol.SubscribeRequest.CreateOrAttach mode)
Subscribe to the given topic for the inputted subscriberId.
|
void |
unsubscribe(com.google.protobuf.ByteString topic,
com.google.protobuf.ByteString subscriberId)
Unsubscribe from a topic that the subscriberId user has previously
subscribed to.
|
void subscribe(com.google.protobuf.ByteString topic,
com.google.protobuf.ByteString subscriberId,
PubSubProtocol.SubscribeRequest.CreateOrAttach mode)
throws PubSubException.CouldNotConnectException,
PubSubException.ClientAlreadySubscribedException,
PubSubException.ServiceDownException,
org.apache.hedwig.client.exceptions.InvalidSubscriberIdException
topic - Topic name of the subscriptionsubscriberId - ID of the subscribermode - Whether to prohibit, tolerate, or require an existing
subscription.PubSubException.CouldNotConnectException - If we are not able to connect to the server hostPubSubException.ClientAlreadySubscribedException - If client is already subscribed to the topicPubSubException.ServiceDownException - If unable to subscribe to topicorg.apache.hedwig.client.exceptions.InvalidSubscriberIdException - If the subscriberId is not valid. We may want to set aside
certain formats of subscriberId's for different purposes.
e.g. local vs. hub subscribervoid asyncSubscribe(com.google.protobuf.ByteString topic,
com.google.protobuf.ByteString subscriberId,
PubSubProtocol.SubscribeRequest.CreateOrAttach mode,
Callback<Void> callback,
Object context)
topic - Topic name of the subscriptionsubscriberId - ID of the subscribermode - Whether to prohibit, tolerate, or require an existing
subscription.callback - Callback to invoke when the subscribe request to the server
has actually gone through. This will have to deal with error
conditions on the async subscribe request.context - Calling context that the Callback needs since this is done
asynchronously.void unsubscribe(com.google.protobuf.ByteString topic,
com.google.protobuf.ByteString subscriberId)
throws PubSubException.CouldNotConnectException,
PubSubException.ClientNotSubscribedException,
PubSubException.ServiceDownException,
org.apache.hedwig.client.exceptions.InvalidSubscriberIdException
topic - Topic name of the subscriptionsubscriberId - ID of the subscriberPubSubException.CouldNotConnectException - If we are not able to connect to the server hostPubSubException.ClientNotSubscribedException - If the client is not currently subscribed to the topicPubSubException.ServiceDownException - If the server was down and unable to complete the requestorg.apache.hedwig.client.exceptions.InvalidSubscriberIdException - If the subscriberId is not valid. We may want to set aside
certain formats of subscriberId's for different purposes.
e.g. local vs. hub subscribervoid asyncUnsubscribe(com.google.protobuf.ByteString topic,
com.google.protobuf.ByteString subscriberId,
Callback<Void> callback,
Object context)
topic - Topic name of the subscriptionsubscriberId - ID of the subscribercallback - Callback to invoke when the unsubscribe request to the server
has actually gone through. This will have to deal with error
conditions on the async unsubscribe request.context - Calling context that the Callback needs since this is done
asynchronously.void consume(com.google.protobuf.ByteString topic,
com.google.protobuf.ByteString subscriberId,
PubSubProtocol.MessageSeqId messageSeqId)
throws PubSubException.ClientNotSubscribedException
topic - Topic name of the subscriptionsubscriberId - ID of the subscribermessageSeqId - Message Sequence ID for the latest message that the client app
has successfully consumed. All messages up to that point will
also be considered as consumed.PubSubException.ClientNotSubscribedException - If the client is not currently subscribed to the topic based
on the client's local state.boolean hasSubscription(com.google.protobuf.ByteString topic,
com.google.protobuf.ByteString subscriberId)
throws PubSubException.CouldNotConnectException,
PubSubException.ServiceDownException
topic - Topic name of the subscription.subscriberId - ID of the subscriberPubSubException.CouldNotConnectException - If we are not able to connect to the server hostPubSubException.ServiceDownException - If there is an error checking the server if the client has a
subscriptionList<com.google.protobuf.ByteString> getSubscriptionList(com.google.protobuf.ByteString subscriberId) throws PubSubException.CouldNotConnectException, PubSubException.ServiceDownException
subscriberId - ID of the subscriberPubSubException.CouldNotConnectException - If we are not able to connect to the server hostPubSubException.ServiceDownException - If there is an error retrieving the list of topicsvoid startDelivery(com.google.protobuf.ByteString topic,
com.google.protobuf.ByteString subscriberId,
MessageHandler messageHandler)
throws PubSubException.ClientNotSubscribedException
topic - Topic name of the subscriptionsubscriberId - ID of the subscribermessageHandler - Message Handler that will consume the subscribed messagesPubSubException.ClientNotSubscribedException - If the client is not currently subscribed to the topicvoid stopDelivery(com.google.protobuf.ByteString topic,
com.google.protobuf.ByteString subscriberId)
throws PubSubException.ClientNotSubscribedException
topic - Topic name of the subscriptionsubscriberId - ID of the subscriberPubSubException.ClientNotSubscribedException - If the client is not currently subscribed to the topicvoid closeSubscription(com.google.protobuf.ByteString topic,
com.google.protobuf.ByteString subscriberId)
throws PubSubException.ServiceDownException
topic - Topic name of the subscriptionsubscriberId - ID of the subscriberPubSubException.ServiceDownException - If the subscribe channel was not able to be closed
successfullyvoid asyncCloseSubscription(com.google.protobuf.ByteString topic,
com.google.protobuf.ByteString subscriberId,
Callback<Void> callback,
Object context)
topic - Topic name of the subscriptionsubscriberId - ID of the subscribercallback - Callback to invoke when the subscribe channel has been closed.context - Calling context that the Callback needs since this is done
asynchronously.Copyright © 2014 The Apache Software Foundation. All Rights Reserved.