This commit is contained in:
2026-05-09 01:18:51 +02:00
parent 7116ee4619
commit 959970c150
132 changed files with 21310 additions and 0 deletions

64
worker.php Normal file
View File

@@ -0,0 +1,64 @@
<?php
declare(strict_types=1);
use Temporal\WorkerFactory;
ini_set('display_errors', 'stderr');
require __DIR__ . '/vendor/autoload.php';
// Bootstrap Laravel for Eloquent, config, etc.
$app = require_once __DIR__ . '/bootstrap/app.php';
$app->make(\Illuminate\Contracts\Console\Kernel::class)->bootstrap();
$factory = WorkerFactory::create();
$worker = $factory->newWorker(taskQueue: env('TEMPORAL_TASK_QUEUE', 'laravel-tasks'));
// Register Workflows
$worker->registerWorkflowTypes(
\App\Temporal\ProductImport\ProductImportWorkflow::class,
\App\Temporal\ProductImport\BatchImportWorkflow::class,
\App\Temporal\OrderFulfillment\OrderFulfillmentWorkflow::class,
\App\Temporal\UserMigration\UserMigrationWorkflow::class,
\App\Temporal\ExternalApiSync\ExternalApiSyncWorkflow::class,
\App\Temporal\WebhookDelivery\WebhookDeliveryWorkflow::class,
\App\Temporal\DataEnrichment\DataEnrichmentWorkflow::class,
\App\Temporal\EloquentQuery\EloquentQueryWorkflow::class,
\App\Temporal\SystemMonitor\SystemMonitorWorkflow::class,
);
// Register Activities (using Laravel container for dependency injection)
$worker->registerActivity(
\App\Temporal\ProductImport\ProductImportActivity::class,
fn(\ReflectionClass $class) => app($class->getName())
);
$worker->registerActivity(
\App\Temporal\OrderFulfillment\OrderActivity::class,
fn(\ReflectionClass $class) => app($class->getName())
);
$worker->registerActivity(
\App\Temporal\UserMigration\UserMigrationActivity::class,
fn(\ReflectionClass $class) => app($class->getName())
);
$worker->registerActivity(
\App\Temporal\ExternalApiSync\ExternalApiSyncActivity::class,
fn(\ReflectionClass $class) => app($class->getName())
);
$worker->registerActivity(
\App\Temporal\WebhookDelivery\WebhookDeliveryActivity::class,
fn(\ReflectionClass $class) => app($class->getName())
);
$worker->registerActivity(
\App\Temporal\DataEnrichment\DataEnrichmentActivity::class,
fn(\ReflectionClass $class) => app($class->getName())
);
$worker->registerActivity(
\App\Temporal\EloquentQuery\EloquentQueryActivity::class,
fn(\ReflectionClass $class) => app($class->getName())
);
$worker->registerActivity(
\App\Temporal\SystemMonitor\SystemMonitorActivity::class,
fn(\ReflectionClass $class) => app($class->getName())
);
$factory->run();