SuperSeller3000/src/Infrastructure/Messenger/Handler/TrackingPushHandler.php
Simon Kuehn fddfd920f5 feat: add Symfony Messenger pipeline with AI agents and handlers
Messages and handlers for the full AI pipeline:
DraftArticle → Validation → SpecsResearch → PhotoUpload → EbayText →
JsonCoding → PublishToChannel / DeactivateListingMessage / TrackingPush /
UpdateStockOnChannels / OrderReceived.

OllamaClient and OllamaClientInterface provide the base LLM backend.
AI agents (EbayTextAgent, JsonCodingAgent, OllamaVisionAgent,
SpecsResearchAgent) wrap the client with task-specific prompts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 22:43:47 +00:00

45 lines
1.5 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Infrastructure\Messenger\Handler;
use App\Application\Channel\ChannelAdapterRegistry;
use App\Domain\Order\Repository\OrderRepositoryInterface;
use App\Infrastructure\Messenger\Message\TrackingPushMessage;
use Psr\Log\LoggerInterface;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
use Symfony\Component\Messenger\Exception\UnrecoverableMessageHandlingException;
use Symfony\Component\Uid\Uuid;
#[AsMessageHandler]
final class TrackingPushHandler
{
public function __construct(
private readonly OrderRepositoryInterface $orders,
private readonly ChannelAdapterRegistry $channelAdapters,
private readonly LoggerInterface $logger,
) {
}
public function __invoke(TrackingPushMessage $message): void
{
$order = $this->orders->findById(Uuid::fromString($message->orderId));
if (null === $order) {
throw new UnrecoverableMessageHandlingException("Order {$message->orderId} not found");
}
$platformType = $order->getPlatform()->getType();
$adapter = $this->channelAdapters->get($platformType);
$adapter->pushTracking($order);
$order->markTrackingPushedToEbay();
$this->orders->save($order);
$this->logger->info('Tracking pushed to channel', [
'orderId' => $message->orderId,
'platform' => $platformType,
'trackingNumber' => $message->trackingNumber,
]);
}
}