|
17 | 17 | use Native\Laravel\Contracts\ChildProcess as ChildProcessContract; |
18 | 18 | use Native\Laravel\Contracts\GlobalShortcut as GlobalShortcutContract; |
19 | 19 | use Native\Laravel\Contracts\PowerMonitor as PowerMonitorContract; |
| 20 | +use Native\Laravel\Contracts\QueueWorker as QueueWorkerContract; |
20 | 21 | use Native\Laravel\Contracts\WindowManager as WindowManagerContract; |
| 22 | +use Native\Laravel\DTOs\QueueConfig; |
21 | 23 | use Native\Laravel\Events\EventWatcher; |
22 | 24 | use Native\Laravel\Exceptions\Handler; |
23 | 25 | use Native\Laravel\GlobalShortcut as GlobalShortcutImplementation; |
@@ -73,6 +75,10 @@ public function packageRegistered() |
73 | 75 | return $app->make(PowerMonitorImplementation::class); |
74 | 76 | }); |
75 | 77 |
|
| 78 | + $this->app->bind(QueueWorkerContract::class, function (Foundation $app) { |
| 79 | + return $app->make(QueueWorker::class); |
| 80 | + }); |
| 81 | + |
76 | 82 | if (config('nativephp-internal.running')) { |
77 | 83 | $this->app->singleton( |
78 | 84 | \Illuminate\Contracts\Debug\ExceptionHandler::class, |
@@ -112,6 +118,8 @@ protected function configureApp() |
112 | 118 |
|
113 | 119 | config(['session.driver' => 'file']); |
114 | 120 | config(['queue.default' => 'database']); |
| 121 | + |
| 122 | + $this->fireUpQueueWorkers(); |
115 | 123 | } |
116 | 124 |
|
117 | 125 | protected function rewriteStoragePath() |
@@ -210,4 +218,13 @@ protected function configureDisks(): void |
210 | 218 | ]); |
211 | 219 | } |
212 | 220 | } |
| 221 | + |
| 222 | + protected function fireUpQueueWorkers(): void |
| 223 | + { |
| 224 | + $queueConfigs = QueueConfig::fromConfigArray(config('nativephp.queue_workers')); |
| 225 | + |
| 226 | + foreach ($queueConfigs as $queueConfig) { |
| 227 | + $this->app->make(QueueWorkerContract::class)->up($queueConfig); |
| 228 | + } |
| 229 | + } |
213 | 230 | } |
0 commit comments