public void registerMessage()

in amazon-sns-trigger-server/src/main/java/jetbrains/buildServer/clouds/amazon/sns/trigger/service/SnsBuildTriggerService.java [121:141]


  public void registerMessage(@NotNull SnsNotificationDto notificationDto, @NotNull CustomDataStorageWrapper cds) throws AwsSnsHttpEndpointException {
    String messagesMapAsString = cds.getValue(AwsSnsTriggerConstants.TRIGGER_STORE_MESSAGES);

    try {
      HashMap<String, SnsNotificationDto> messagesMap;
      if (messagesMapAsString == null) {
        messagesMap = new HashMap<>();
      } else {
        messagesMap = myObjectMapper.readValue(messagesMapAsString, new TypeReference<HashMap<String, SnsNotificationDto>>() {
        });
      }

      messagesMap.put(notificationDto.getMessageId(), notificationDto);
      String updatedMessagesMapAsString = myObjectMapper.writeValueAsString(messagesMap);
      cds.putValue(AwsSnsTriggerConstants.TRIGGER_STORE_MESSAGES, updatedMessagesMapAsString);
    } catch (Exception e) {
      throw new AwsSnsHttpEndpointException("Can't register incoming notification", e);
    }

    cds.flush();
  }