public void subscribe() throws URISyntaxException, TransportConfigException {

    /*
     * if this instance of the transport (as there could be several - each with
     * a different topic) is in shutdown mode then don't subscribe. This is a
     * side effect of when you shutdown a sns transport and the listener gets an
     * UnsubscribeConfirmation. In normal operation, when the topic does
     * occasional house keeping and clears out the subscriptions, running
     * transports will just re-subscribe.
     */
    if (_inShutdown)
      return;

    URI url = getBaseSubscriptionURI();

    String subscriptionURL = url.toString() + "listener/sns";
    LOGGER.info("Subscription  URI - " + subscriptionURL);

    SubscribeRequest subRequest = new SubscribeRequest(_argoTopicName, "http", subscriptionURL);
    try {
      getSNSClient().subscribe(subRequest);
    } catch (AmazonServiceException e) {
      throw new TransportConfigException("Error subscribing to SNS topic.", e);
    }
    // get request id for SubscribeRequest from SNS metadata
    this._subscriptionArn = getSNSClient().getCachedResponseMetadata(subRequest).toString();
    LOGGER.info("SubscribeRequest - " + _subscriptionArn);
  }
public void subscribe ( ) throws URISyntaxException , TransportConfigException { if ( _inShutdown ) return ; URI url = getBaseSubscriptionURI ( ) ; String subscriptionURL = url . toString ( ) + "listener/sns" ; LOGGER . info ( "Subscription  URI - " + subscriptionURL ) ; SubscribeRequest subRequest = new SubscribeRequest ( _argoTopicName , "http" , subscriptionURL ) ; try { getSNSClient ( ) . subscribe ( subRequest ) ; } catch ( AmazonServiceException e ) { throw new TransportConfigException ( "Error subscribing to SNS topic." , e ) ; } this . _subscriptionArn = getSNSClient ( ) . getCachedResponseMetadata ( subRequest ) . toString ( ) ; LOGGER . info ( "SubscribeRequest - " + _subscriptionArn ) ; }
Attempt to subscript to the Argo SNS topic.

@throws URISyntaxException if the subscription HTTP URL is messed up
@throws TransportConfigException if there was some Amazon specific issue
while subscribing