Skip to content

Commit 29e1629

Browse files
committed
send procedural TPC message to ping
Signed-off-by: sergiu <sergiubota@rospace.com>
1 parent fb2777f commit 29e1629

5 files changed

Lines changed: 16 additions & 102 deletions

File tree

composer.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
},
2929
"require": {
3030
"php": "~8.2.0 || ~8.3.0",
31-
"ext-sockets": "*",
32-
"clue/socket-raw": "^v1.6.0",
3331
"dotkernel/dot-cache": "^4.3.0",
3432
"dotkernel/dot-cli": "^3.9.0",
3533
"dotkernel/dot-data-fixtures": "^1.4.0",
@@ -81,8 +79,7 @@
8179
"Core\\App\\": "src/Core/src/App/src",
8280
"Core\\Security\\": "src/Core/src/Security/src",
8381
"Core\\Setting\\": "src/Core/src/Setting/src",
84-
"Core\\User\\": "src/Core/src/User/src",
85-
"Core\\NotificationSystem\\": "src/Core/src/NotificationSystem/src"
82+
"Core\\User\\": "src/Core/src/User/src"
8683
}
8784
},
8885
"autoload-dev": {

config/config.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ class_exists(Mezzio\Tooling\ConfigProvider::class)
7474
Core\Security\ConfigProvider::class,
7575
Core\Setting\ConfigProvider::class,
7676
Core\User\ConfigProvider::class,
77-
Core\NotificationSystem\ConfigProvider::class,
7877

7978
// Load application config in a pre-defined order in such a way that local settings
8079
// overwrite global settings. (Loaded as first to last):

src/Core/src/NotificationSystem/src/ConfigProvider.php

Lines changed: 0 additions & 41 deletions
This file was deleted.

src/Core/src/NotificationSystem/src/Service/NotificationService.php

Lines changed: 0 additions & 52 deletions
This file was deleted.

src/User/src/Handler/PostUserCreateHandler.php

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
use Admin\User\Service\UserServiceInterface;
1313
use Core\App\Message;
1414
use Core\App\Service\MailService;
15-
use Core\NotificationSystem\Service\NotificationService;
1615
use Dot\DependencyInjection\Attribute\Inject;
1716
use Dot\FlashMessenger\FlashMessengerInterface;
1817
use Dot\Log\Logger;
@@ -27,6 +26,11 @@
2726
use Psr\Http\Server\RequestHandlerInterface;
2827
use Throwable;
2928

29+
use function fclose;
30+
use function fwrite;
31+
use function json_encode;
32+
use function stream_socket_client;
33+
3034
/**
3135
* @phpstan-import-type CreateUserDataType from CreateUserInputFilter
3236
*/
@@ -42,7 +46,6 @@ class PostUserCreateHandler implements RequestHandlerInterface
4246
FlashMessengerInterface::class,
4347
CreateUserForm::class,
4448
MailService::class,
45-
NotificationService::class,
4649
'dot-log.default_logger',
4750
'config',
4851
)]
@@ -53,7 +56,6 @@ public function __construct(
5356
protected FlashMessengerInterface $messenger,
5457
protected CreateUserForm $createUserForm,
5558
protected MailService $mailService,
56-
protected NotificationService $notificationService,
5759
protected Logger $logger,
5860
protected array $config,
5961
) {
@@ -74,7 +76,16 @@ public function handle(ServerRequestInterface $request): ResponseInterface
7476
$user = $this->userService->saveUser($data);
7577
$this->messenger->addSuccess(Message::USER_CREATED);
7678
if ($user->hasEmail()) {
77-
$this->notificationService->sendNewAccountNotification($user);
79+
$client = stream_socket_client("tcp://localhost:8556", $errno, $errstr, 30);
80+
81+
if (! $client) {
82+
echo "Error: $errstr ($errno)\n";
83+
} else {
84+
$data['userUuid'] = $user->getUuid()->toString();
85+
fwrite($client, json_encode($data) . "\n");
86+
87+
fclose($client);
88+
}
7889
}
7990

8091
return new EmptyResponse(StatusCodeInterface::STATUS_CREATED);

0 commit comments

Comments
 (0)