SubscriptionService

public interface SubscriptionService

This is an interface which provides business logic for a subscription/unsubscription request.

Author:Anuranjan

Methods

subscribe

Long subscribe(String callbackUrl, Modes hubMode, String topic, String leaseSeconds, String secret)

This method executes the business logic for subscribing/unsubscribing to a topic. The subscriber provides the callback URL where the update notification should be sent. Returns the id of the IntentVerificationThreadRunnable thread which verifies the intent of the subscriber requesting subscription. If hubMode is “unsubscribe” the thread won’t be created and the method will return null.

Parameters:
  • callbackUrl
    • a String representing the subscriber’s callback URL where notifications should be delivered
  • hubMode
    • a Modes enum representing the mode “subscribe” or “unsubscribe”, depending on the goal of the request
  • topic
    • a String representing the topic URL that the subscriber wishes to subscribe to or unsubscribe from
  • leaseSeconds
    • a String representing the number of seconds for which the subscriber would like to have the subscription active. This is an optional parameter
  • secret
    • a String provided by the subscriber which will be used to compute an HMAC digest for authorized content distribution. Currently this is not being consumed by the API
Throws:
  • HubException
    • when unsubscribing from a topic that was not subscribed to, when the topic does not exist or when the topic was not found
Returns:

the id of IntentVerificationThreadRunnable which is created, if the thread wasn’t created then returns null