com.amazonaws.services.sns.model.UnsubscribeRequest Java Examples

The following examples show how to use com.amazonaws.services.sns.model.UnsubscribeRequest. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SnsMessageBroker.java    From xyz-hub with Apache License 2.0 7 votes vote down vote up
private void unsubscribe(Subscription subscription) {
  if (PENDING_CONFIRMATION.equals(subscription.getSubscriptionArn())) {
    logger.warn("Could not remove subscription ({}) because it's pending for confirmation. It will be removed automatically "
        + "after 3 days.", subscription.getEndpoint());
    return;
  }
  SNS_CLIENT.unsubscribeAsync(subscription.getSubscriptionArn(), new AsyncHandler<UnsubscribeRequest, UnsubscribeResult>() {
    @Override
    public void onError(Exception e) {
      logger.error("Error un-subscribing endpoint {} from SNS: {}", subscription.getEndpoint(), e);
    }

    @Override
    public void onSuccess(UnsubscribeRequest request, UnsubscribeResult unsubscribeResult) {
      logger.debug("Endpoint {} has been successfully un-subscribed from SNS.", subscription.getEndpoint());
    }
  });
}
 
Example #2
Source File: AwsGlacierInventoryRetriever.java    From core with GNU General Public License v3.0 4 votes vote down vote up
/**
* To be called when done with this object. Cleans up notifications for when
* jobs complete.
*/
  private void cleanUp() {
      snsClient.unsubscribe(new UnsubscribeRequest(snsSubscriptionARN));
      snsClient.deleteTopic(new DeleteTopicRequest(snsTopicARN));
      sqsClient.deleteQueue(new DeleteQueueRequest(sqsQueueURL));
  }
 
Example #3
Source File: SubscriptionImpl.java    From aws-sdk-java-resources with Apache License 2.0 4 votes vote down vote up
@Override
public void delete(UnsubscribeRequest request) {
    delete(request, null);
}
 
Example #4
Source File: SubscriptionImpl.java    From aws-sdk-java-resources with Apache License 2.0 4 votes vote down vote up
@Override
public void delete(UnsubscribeRequest request, ResultCapture<Void> extractor
        ) {

    resource.performAction("Delete", request, extractor);
}
 
Example #5
Source File: SubscriptionImpl.java    From aws-sdk-java-resources with Apache License 2.0 4 votes vote down vote up
@Override
public void delete(ResultCapture<Void> extractor) {
    UnsubscribeRequest request = new UnsubscribeRequest();
    delete(request, extractor);
}
 
Example #6
Source File: Subscription.java    From aws-sdk-java-resources with Apache License 2.0 2 votes vote down vote up
/**
 * Performs the <code>Delete</code> action.
 *
 * <p>
 * The following request parameters will be populated from the data of this
 * <code>Subscription</code> resource, and any conflicting parameter value
 * set in the request will be overridden:
 * <ul>
 *   <li>
 *     <b><code>SubscriptionArn</code></b>
 *         - mapped from the <code>Arn</code> identifier.
 *   </li>
 * </ul>
 *
 * <p>
 *
 * @see UnsubscribeRequest
 */
void delete(UnsubscribeRequest request);
 
Example #7
Source File: Subscription.java    From aws-sdk-java-resources with Apache License 2.0 2 votes vote down vote up
/**
 * Performs the <code>Delete</code> action and use a ResultCapture to
 * retrieve the low-level client response.
 *
 * <p>
 * The following request parameters will be populated from the data of this
 * <code>Subscription</code> resource, and any conflicting parameter value
 * set in the request will be overridden:
 * <ul>
 *   <li>
 *     <b><code>SubscriptionArn</code></b>
 *         - mapped from the <code>Arn</code> identifier.
 *   </li>
 * </ul>
 *
 * <p>
 *
 * @see UnsubscribeRequest
 */
void delete(UnsubscribeRequest request, ResultCapture<Void> extractor);