private void handleNotification()

in amazon-sns-trigger-server/src/main/java/jetbrains/buildServer/clouds/amazon/sns/trigger/controllers/AwsSnsHttpEndpointController.java [150:170]


  private void handleNotification(
          @NotNull BuildTriggerDescriptor buildTrigger,
          @NotNull CustomDataStorageWrapper cds,
          @NotNull SnsNotificationDto dto
  ) throws AwsSnsHttpEndpointException {
    String expectedArn = cds.getValue(AwsSnsTriggerConstants.TRIGGER_STORE_CURRENT_SUBSCRIPTION_ARN);
    String currentArn = dto.getSubscriptionArn();
    String unsubscribeUrl = dto.getUnsubscribeUrl();

    if (expectedArn == null || !expectedArn.equals(currentArn)) {
      throw new AwsSnsHttpEndpointException("Trigger " + buildTrigger.getTriggerName() + " isn't subscribed to topic " + dto.getTopic());
    }

    cds.putValue(AwsSnsTriggerConstants.TRIGGER_STORE_CURRENT_UNSUBSCRIBE_URL, unsubscribeUrl);

    BuildTriggerService bts = buildTrigger.getBuildTriggerService();
    if (bts instanceof SnsBuildTriggerService) {
      SnsBuildTriggerService btService = (SnsBuildTriggerService) bts;
      btService.registerMessage(dto, cds);
    }
  }