-
Notifications
You must be signed in to change notification settings - Fork 76
Лаб. 4 6413 Верховая Анна #269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
DmitryKrakhmalev
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Есть замечания которые необходимо устранить и запросить повторный ревью.
Запрос на ревью принимаю только до 20:00 - если не успеете оценка понизится
| public class DataGeneratorService( | ||
| NatsPublisher natsPublisher, | ||
| ILogger<DataGeneratorService> logger, | ||
| int batchSize = 10, | ||
| int delayBetweenBatchesMs = 5000) : BackgroundService |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Вы планируете работать с данным классом не через DI? Так то он должен регистрироваться как HostedService.
Не очень понимаю зачем в конструктор подавать batchSize и delayBetweenBatchedMs - берите их из конфига.
Оптимальный конечно же вариант как IOptions, ну тут как уж реализуете.
| @@ -0,0 +1,43 @@ | |||
| using RealEstateAgency.Generator.Services; | |||
|
|
|||
| var builder = Host.CreateApplicationBuilder(args); | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AddServiceDefaults
DmitryKrakhmalev
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Засчитываю работу. Данные генерируются. По сути проблема в одной строчке.
| // Generator | ||
| builder.AddProject<Projects.RealEstateAgency_Generator>("generator") | ||
| .WithReference(nats) | ||
| .WaitFor(nats) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
В целом если вам нужны какие то адреса - можно просто через переменные окружения их пробрасывать:
| .WaitFor(nats) | |
| .WaitFor(nats) | |
| .WithEnvironment("Nats__Url",nats.GetEndpoint("tcp")) |
Тут же вам было бы достаточно обратиться к ConnectionString с именем "nats"
|
|
||
| builder.AddServiceDefaults(); | ||
|
|
||
| var natsConnectionString = "nats://localhost:4222"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.


ФИО: Верховая Анна
Номер группы: 6413
Номер лабораторной: 4
Номер варианта: 61
Краткое описание предметной области: Риэлторское агентство
Краткое описание добавленных фич: Добавлен генератор тестовых данных, отправляющий контрагентов и объекты недвижимости через NATS. WebAPI получает сообщения фоновым сервисом и сохраняет в MongoDB. Реализованы retry-механизмы для подключений к БД и NATS. Вся инфраструктура оркестрируется через .NET Aspire AppHost.