This commit is contained in:
@@ -8,6 +8,7 @@ import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.kafka.core.KafkaTemplate;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.function.EntityResponse;
|
||||
import ru.soune.nocopy.dto.monitoring.MonitoringDTO;
|
||||
import ru.soune.nocopy.entity.monitoring.FileMonitoringEntity;
|
||||
import ru.soune.nocopy.repository.FileMonitoringRepository;
|
||||
@@ -73,4 +74,20 @@ public class HealtCheckController {
|
||||
this.buildTimeBack = buildTimeBack;
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/test/monitoring/{fileId}")
|
||||
public ResponseEntity<?> startMonitoringKafka(@PathVariable String fileId) throws JsonProcessingException {
|
||||
MonitoringDTO monitoringYandexDTO = MonitoringDTO.builder().baseUrl(baseUrl).
|
||||
fileId(fileId)
|
||||
.engine("yandex_reverse_image")
|
||||
.searchType("visual_matches")
|
||||
.build();
|
||||
|
||||
kafkaTemplate.send("monitoring-commands", objectMapper.writeValueAsString(monitoringYandexDTO));
|
||||
|
||||
|
||||
return ResponseEntity
|
||||
.ok()
|
||||
.body("OK");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user