|
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,11 @@ protected function configureApp() |
112 | 118 |
|
113 | 119 | config(['session.driver' => 'file']); |
114 | 120 | config(['queue.default' => 'database']); |
| 121 | + |
| 122 | + // XXX: This logic may need to change when we ditch the internal web server |
| 123 | + if (! $this->app->runningInConsole()) { |
| 124 | + $this->fireUpQueueWorkers(); |
| 125 | + } |
115 | 126 | } |
116 | 127 |
|
117 | 128 | protected function rewriteStoragePath() |
@@ -210,4 +221,13 @@ protected function configureDisks(): void |
210 | 221 | ]); |
211 | 222 | } |
212 | 223 | } |
| 224 | + |
| 225 | + protected function fireUpQueueWorkers(): void |
| 226 | + { |
| 227 | + $queueConfigs = QueueConfig::fromConfigArray(config('nativephp.queue_workers')); |
| 228 | + |
| 229 | + foreach ($queueConfigs as $queueConfig) { |
| 230 | + $this->app->make(QueueWorkerContract::class)->up($queueConfig); |
| 231 | + } |
| 232 | + } |
213 | 233 | } |
0 commit comments