Code for M1

mail@pastecode.io avatar
unknown
plain_text
8 months ago
1.1 kB
2
Indexable
Never
/**
   * sqs message from CR Analytics Engine.
   *
   * @param messagePayload contains audit related data sent by analytics engine
   * @param headers Message header to get retry count and message ID
   */
  @SqsListener(value = "${audit.call-recording-analytics-engine.queue}")
  public void listen(final String messagePayload, final @Headers MessageHeaders headers) {

    try {
      log.info("MessagePayload {}", messagePayload);
      final ObjectMapper objectMapper = new ObjectMapper();
      final JsonNode jsonNode = objectMapper.readTree(messagePayload);
      log.info("JsonNode {}", jsonNode);
      final String message = jsonNode.get("Message").asText();
      log.info("message {}", message);
      final AnalyticsEngineAuditInfoDto analyticsEngineAuditInfoDto =
          objectMapper.readValue(message, AnalyticsEngineAuditInfoDto.class);
      log.info("AnalyticsEngineAuditInfoDto {}", analyticsEngineAuditInfoDto);
    } catch (final Exception e) {
      log.info("Error case", e);
      throw new CallRecordingBaseRuntimeException(ANALYTICS_ENGINE_PARSER_ERROR);
    }
Leave a Comment