Skip to content

Conversation

@impatient0
Copy link
Owner

Добавлен сервис Analyzer, замыкающий цикл обработки данных.

  • Потребляет события HubEvent и SensorsSnapshot из Kafka.
  • Хранит конфигурацию устройств и сценариев в PostgreSQL с использованием JPA.
  • Анализирует снапшоты состояния и, при выполнении условий сценариев, отправляет команды на исполнение в Hub Router через gRPC.

Copy link

@kesch9 kesch9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Отличная работа

max.poll.interval.ms: 30000
producer:
value-serializer: ru.yandex.practicum.kafka.telemetry.serializer.SensorSnapshotAvroSerializer
value-serializer: ru.yandex.practicum.kafka.telemetry.serializer.SensorSnapshotSerializer
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

В интерфейсе SnapshotService лишний public у метода, он избыточен

case DeviceRemovedEventAvro removed -> {
sensorRepository.deleteById(removed.getId());
}
case ScenarioAddedEventAvro added -> {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Переменную added лучше переименовать, она совпадает с первым case

case DeviceAddedEventAvro added -> {
sensorRepository.save(eventMapper.toSensorEntity(event.getHubId(), added));
}
case DeviceRemovedEventAvro removed -> {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Можно написать в компактном виде, на мой взгляд лучше выглядит

case DeviceAddedEventAvro added -> sensorRepository.save(eventMapper.toSensorEntity(event.getHubId(), added));
case DeviceRemovedEventAvro removed -> sensorRepository.deleteById(removed.getId());

@impatient0 impatient0 merged commit 8995574 into develop Jul 27, 2025
2 checks passed
@impatient0 impatient0 deleted the 4-analyzer branch July 27, 2025 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants