Skip to content
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

GKarman/hw19 rabbit-mq #1165

Open
wants to merge 15 commits into
base: GKarman/main
Choose a base branch
from
Open

GKarman/hw19 rabbit-mq #1165

wants to merge 15 commits into from

Conversation

gkarman
Copy link

@gkarman gkarman commented Mar 21, 2024

No description provided.

README.md Outdated
docker-compose up -d
```

3. Зайти внутрь php-fpm и запустить скрипт consumer
Copy link

Choose a reason for hiding this comment

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

Было бы лучше если бы сам скрипт стартовал. Для этого можно создать отдельный контейнер в котором он будет запускаться.

Copy link
Author

Choose a reason for hiding this comment

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

сделал

@@ -0,0 +1,24 @@
<?php
Copy link

Choose a reason for hiding this comment

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

Поправьте все замечания линтера.

Copy link
Author

Choose a reason for hiding this comment

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

сделал

use Gkarman\Rabbitmq\Modules\OrderReport\Domain\ValueObject\ReportDateFrom;
use Gkarman\Rabbitmq\Modules\OrderReport\Domain\ValueObject\ReportDateTo;

class OrderReportRequest
Copy link

Choose a reason for hiding this comment

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

Можно воспользоваться readonly классом

Copy link
Author

Choose a reason for hiding this comment

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

сделал

*/
private function init(): void
{
$configs = parse_ini_file('src/Configs/rabbitMQ.ini');
Copy link

Choose a reason for hiding this comment

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

Лучше выделить в отдельный класс, в котором разобрать файл и разложить по свойствам. Объект этого класса передать сюда через конструктор данного класса.

Copy link
Author

Choose a reason for hiding this comment

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

сделал


class RabbitMQConfigs
{
private readonly ?string $host;
Copy link

Choose a reason for hiding this comment

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

Поправьте все замечания линтера.

Copy link
Author

Choose a reason for hiding this comment

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

поравил

{
public function run()
{
$configs = parse_ini_file('src/Configs/rabbitMQ.ini');
Copy link

Choose a reason for hiding this comment

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

Тут остался парсинг ini файла.

Copy link
Author

Choose a reason for hiding this comment

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

Убрал, спасибо

public function run()
{
$configs = parse_ini_file('src/Configs/rabbitMQ.ini');
$connection = new AMQPStreamConnection($configs['host'], $configs['port'], $configs['user'], $configs['password']);
Copy link

Choose a reason for hiding this comment

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

Лучше создать вне данного класса и сюда прокинуть как зависимость.

Copy link
Author

Choose a reason for hiding this comment

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

Сделал, спасибо!

{
try {
$generateOrderRequest = GenerateOrderRequest::createFromArray($request);
$useCase = new GenerateReportUseCase(new RabbitMQQueueRepository());
Copy link

Choose a reason for hiding this comment

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

Лучше создать вне текущего класса и сюда прокинуть как зависимость, через конструктор.

Copy link
Author

Choose a reason for hiding this comment

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

Cделал, спасибо

*/
private function init(RabbitMqConfigs $rabbitMQConfigs): void
{
$this->connection = new AMQPStreamConnection(
Copy link

Choose a reason for hiding this comment

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

Лучше создать вне текущего класса и сюда прокинуть как зависимость, через конструктор.

Copy link
Author

Choose a reason for hiding this comment

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

Сделал, спасибо

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.

2 participants