This commit is contained in:
@@ -1,15 +1,21 @@
|
||||
package ru.soune.nocopy.kafka;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.kafka.annotation.KafkaListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
import ru.soune.nocopy.dto.file.YandexSearchResponse;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class MonitoringResultListener {
|
||||
|
||||
@KafkaListener(topics = "monitoring-results", groupId = "dashboard")
|
||||
public void handleCommand(String commandMessage) {
|
||||
log.info("Monitoring result: " + commandMessage);
|
||||
private final ObjectMapper objectMapper;
|
||||
|
||||
// @KafkaListener(topics = "monitoring-results", groupId = "dashboard")
|
||||
public void handleCommand(String message) {
|
||||
YandexSearchResponse yandexSearchResponse = objectMapper.convertValue(message, YandexSearchResponse.class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,7 +119,8 @@ public class MonitoringSearchService {
|
||||
monitoring.getFile(), "google_lens", "exact_matches");
|
||||
|
||||
List<YandexSearchResponse.ImageResult> googleImages =
|
||||
searchImageService.getAllImagesWithoutPagination(googleResponse, "exact_matches");
|
||||
searchImageService.getAllImagesWithoutPagination(googleResponse,
|
||||
"exact_matches");
|
||||
|
||||
allResults.addAll(googleImages);
|
||||
log.info("Google search found {} results", googleImages.size());
|
||||
|
||||
@@ -1,4 +1,13 @@
|
||||
spring:
|
||||
# kafka:
|
||||
# bootstrap-servers: kafka:9092
|
||||
# consumer:
|
||||
# group-id: dashboard
|
||||
# key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
|
||||
# value-deserializer: org.apache.kafka.common.serialization.StringDeserializer
|
||||
# producer:
|
||||
# key-serializer: org.apache.kafka.common.serialization.StringSerializer
|
||||
# value-serializer: org.apache.kafka.common.serialization.StringSerializer
|
||||
cloud:
|
||||
compatibility-verifier:
|
||||
enabled: false
|
||||
|
||||
Reference in New Issue
Block a user