This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
package ru.soune.nocopy.kafka;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.kafka.annotation.KafkaListener;
|
||||
@@ -16,13 +14,8 @@ public class MonitoringResultListener {
|
||||
|
||||
private final ViolationService violationService;
|
||||
|
||||
private final ObjectMapper objectMapper;
|
||||
|
||||
@KafkaListener(topics = "monitoring-results", groupId = "dashboard")
|
||||
public void handleCommand(String message) throws JsonProcessingException {
|
||||
YandexSearchResponse.ImageResult imageResult =
|
||||
objectMapper.readValue(message, YandexSearchResponse.ImageResult.class);
|
||||
|
||||
public void handleCommand(YandexSearchResponse.ImageResult imageResult) {
|
||||
violationService.processViolation(imageResult.getUrl(), imageResult.getHost(), imageResult.getPageUrl(),
|
||||
imageResult.getFileId(), imageResult.getPageTitle());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user