Package org.springframework.integration.aws.sqs.core

Examples of org.springframework.integration.aws.sqs.core.SqsExecutor


  private void processSqsSubscription(Subscription sqsSubscription) {
    Assert.state(sqsExecutorMap != null,
        "'sqsExecutorMap' must not be null");

    SqsExecutor sqsExecutor = null;
    String endpointValue = sqsSubscription.getEndpoint();
    if (sqsExecutorMap.containsKey(endpointValue)) {
      sqsExecutor = sqsExecutorMap.get(endpointValue);
      sqsSubscription.setEndpoint(sqsExecutor.getQueueArn());
    } else {
      // endpointValue is the queue-arn
      sqsSubscription.setEndpoint(endpointValue);
    }

    String snsSqsSubscriptionArn = null;
    for (Subscription subscription : client.listSubscriptions()
        .getSubscriptions()) {
      if (subscription.getTopicArn().equals(topicArn)
          && subscription.getProtocol().equals(
              sqsSubscription.getProtocol())
          && subscription.getEndpoint().equals(
              sqsSubscription.getEndpoint())) {
        snsSqsSubscriptionArn = subscription.getSubscriptionArn();
        break;
      }
    }
    if (snsSqsSubscriptionArn == null) {
      SubscribeRequest request = new SubscribeRequest(topicArn,
          sqsSubscription.getProtocol(),
          sqsSubscription.getEndpoint());
      SubscribeResult result = client.subscribe(request);
      snsSqsSubscriptionArn = result.getSubscriptionArn();
      log.info("Subscribed SQS to SNS with subscription ARN: "
          + snsSqsSubscriptionArn);
    } else {
      log.info("Already subscribed with ARN: " + snsSqsSubscriptionArn);
    }
    if (sqsExecutor != null) {
      sqsExecutor.addSnsPublishPolicy(topicName, topicArn);
    }
  }
View Full Code Here


  private void processSqsSubscription(Subscription sqsSubscription) {
    Assert.state(sqsExecutorMap != null,
        "'sqsExecutorMap' must not be null");

    SqsExecutor sqsExecutor = null;
    String endpointValue = sqsSubscription.getEndpoint();
    if (sqsExecutorMap.containsKey(endpointValue)) {
      sqsExecutor = sqsExecutorMap.get(endpointValue);
      sqsSubscription.setEndpoint(sqsExecutor.getQueueArn());
    } else {
      // endpointValue is the queue-arn
      sqsSubscription.setEndpoint(endpointValue);
    }

    String snsSqsSubscriptionArn = null;
    for (Subscription subscription : client.listSubscriptions()
        .getSubscriptions()) {
      if (subscription.getTopicArn().equals(topicArn)
          && subscription.getProtocol().equals(
              sqsSubscription.getProtocol())
          && subscription.getEndpoint().equals(
              sqsSubscription.getEndpoint())) {
        snsSqsSubscriptionArn = subscription.getSubscriptionArn();
        break;
      }
    }
    if (snsSqsSubscriptionArn == null) {
      SubscribeRequest request = new SubscribeRequest(topicArn,
          sqsSubscription.getProtocol(),
          sqsSubscription.getEndpoint());
      SubscribeResult result = client.subscribe(request);
      snsSqsSubscriptionArn = result.getSubscriptionArn();
      log.info("Subscribed SQS to SNS with subscription ARN: "
          + snsSqsSubscriptionArn);
    } else {
      log.info("Already subscribed with ARN: " + snsSqsSubscriptionArn);
    }
    if (sqsExecutor != null) {
      sqsExecutor.addSnsPublishPolicy(topicName, topicArn);
    }
  }
View Full Code Here

TOP

Related Classes of org.springframework.integration.aws.sqs.core.SqsExecutor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.