You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| `CLOUD_TASKS_PROJECT`| The project your queue belongs to. | `my-project`
83
-
| `CLOUD_TASKS_LOCATION`| The region where the project is hosted. | `europe-west6`
84
-
| `CLOUD_TASKS_QUEUE`| The default queue a job will be added to. | `emails`
85
-
| **App Engine**
86
-
| `APP_ENGINE_TASK` (optional) | Set to true to use App Engine task (else a Http task will be used). Defaults to false. | `true`
87
-
| `APP_ENGINE_SERVICE` (optional) | The App Engine service to handle the task (only if using App Engine task). | `api`
88
-
| **Non-App Engine apps**
89
-
| `CLOUD_TASKS_SERVICE_EMAIL`(optional) | The email address of the service account. Important, it should have the correct roles. See the section below which roles. | `[email protected]`
90
-
| `CLOUD_TASKS_HANDLER` (optional) | The URL that Cloud Tasks will call to process a job. This should be the URL to your Laravel app. By default we will use the URL that dispatched the job. | `https://<yourwebsite>.com`
|`CLOUD_TASKS_PROJECT`| The project your queue belongs to. |`my-project`|
83
+
|`CLOUD_TASKS_LOCATION`| The region where the project is hosted. |`europe-west6`|
84
+
|`CLOUD_TASKS_QUEUE`| The default queue to which a job will be added. |`emails`|
85
+
|**App Engine**|||
86
+
|`APP_ENGINE_TASK` (optional) | Set to true to use an App Engine task (otherwise an HTTP task will be used). Defaults to false. |`true`|
87
+
|`APP_ENGINE_SERVICE` (optional) | The App Engine service that will handle the task (only if using App Engine tasks). |`api`|
88
+
|**Non-App Engine Apps**|||
89
+
|`CLOUD_TASKS_SERVICE_EMAIL` (optional) | The service account's email address. It must have the required roles (see below). |`[email protected]`|
90
+
|`CLOUD_TASKS_HANDLER` (optional) | The URL that Cloud Tasks will call to process a job. Should point to your Laravel app. Defaults to the URL that dispatched the job. |`https://<your-website>.com`|
91
91
92
-
</details>
92
+
---
93
93
94
94
Optionally, you may publish the config file:
95
95
96
96
```console
97
97
php artisan vendor:publish --tag=cloud-tasks
98
98
```
99
99
100
-
If you are using separate services for dispatching and handling tasks, and your application only dispatches jobs and should not be able to handle jobs, you may disable the task handler from`config/cloud-tasks.php`:
100
+
If you're using separate services for dispatching and handling tasks, and your app should only dispatch jobs (not handle them), you may disable the task handler in`config/cloud-tasks.php`:
Modify (or add) the `client_options` key in the `config/cloud-tasks.php` file:
161
+
Edit the `client_options` key in `config/cloud-tasks.php`:
168
162
169
163
```php
170
164
'client_options' => [
@@ -175,63 +169,74 @@ Modify (or add) the `client_options` key in the `config/cloud-tasks.php` file:
175
169
176
170
#### Modify CloudTasksClient options
177
171
178
-
Modify (or add) the `client_options` key in the `config/cloud-tasks.php` file:
172
+
Edit the `client_options` key in `config/cloud-tasks.php`:
179
173
180
174
```php
181
175
'client_options' => [
182
-
// custom options here
176
+
// Custom options here
183
177
]
184
178
```
185
179
186
-
### How it works and differences
180
+
### How it works & differences
181
+
182
+
Using Cloud Tasks as a Laravel queue driver is fundamentally different from other drivers like Redis.
183
+
184
+
With Redis or similar drivers, a worker listens for jobs via `queue:work` or `queue:listen`.
185
+
With Cloud Tasks, jobs are scheduled and dispatched via HTTP requests to your app.
186
+
There’s no need to run `queue:work` or `queue:listen`.
187
187
188
-
Using Cloud Tasks as a Laravel queue driver is fundamentally different than other Laravel queue drivers, like Redis.
188
+
### Good to Know
189
189
190
-
Typically a Laravel queue has a worker that listens to incoming jobs using the `queue:work` / `queue:listen` command.
191
-
With Cloud Tasks, this is not the case. Instead, Cloud Tasks will schedule the job for you and make an HTTP request to
192
-
your application with the job payload. There is no need to run a `queue:work/listen` command.
190
+
Cloud Tasks has its own retry configuration options like:
193
191
194
-
#### Good to know
192
+
- Maximum number of attempts
193
+
- Retry duration
194
+
- Min/max backoff
195
+
- Max doublings
195
196
196
-
Cloud Tasks has it's own retry configuration options: maximum number of attempts, retry duration, min/max backoff and max doublings. All of these options are ignored by this package. Instead, you may configure max attempts, retry duration and backoff strategy right from Laravel.
197
+
These are ignored by this package. Instead, you can configure retry behavior directly in Laravel.
197
198
198
199
### Authentication
199
200
200
-
If you're not using your master service account (which has all abilities), you must add the following roles to make it
201
-
works:
201
+
If you're not using your master service account (which has all abilities), assign the following roles to your service account to make it working:
202
202
203
-
1. App Engine Viewer
204
-
2. Cloud Tasks Enqueuer
205
-
3. Cloud Tasks Viewer
206
-
4. Cloud Tasks Task Deleter
203
+
1. App Engine Viewer
204
+
2. Cloud Tasks Enqueuer
205
+
3. Cloud Tasks Viewer
206
+
4. Cloud Tasks Task Deleter
207
207
5. Service Account User
208
208
209
209
### Upgrading
210
210
211
-
Read[UPGRADING.MD](UPGRADING.md)on how to update versions.
211
+
See[UPGRADING.MD](UPGRADING.md)for instructions on updating versions.
212
212
213
213
### Troubleshooting
214
214
215
-
#### HttpRequest.url must start with 'https://'
215
+
#### `HttpRequest.url` must start with `https://`
216
216
217
-
This can happen when your application runs behind a reverse proxy. To fix this, add the application domain to Laravel's [trusted proxies](https://laravel.com/docs/11.x/requests#trusting-all-proxies). You may need to add the wildcard `*` as trusted proxy.
217
+
This can occur when your application runs behind a reverse proxy.
218
+
To resolve it, add your app’s domain to Laravel’s [trusted proxies](https://laravel.com/docs/11.x/requests#trusting-all-proxies).
This currently seems to be a bug with PHP 8.3 and `googleapis/gax-php`. See [this issue](https://github.com/googleapis/gax-php/issues/584) for more information.
223
+
This seems to be a bug in PHP 8.3 and `googleapis/gax-php`.
224
+
See [this issue](https://github.com/googleapis/gax-php/issues/584) for details.
222
225
223
-
A potential workaround is to disable PHP 8.3 call stack limit by setting this value in `php.ini`:
226
+
A possible workaround is to disable the PHP 8.3 stack limit in `php.ini`:
224
227
225
228
```ini
226
-
zend.max_allowed_stack_size: -1
229
+
zend.max_allowed_stack_size=-1
227
230
```
228
231
229
232
### Contributing
230
233
231
-
You can use the services defined in `docker-compose.yml` to start running the package.
234
+
You can use the services defined in `docker-compose.yml` to run the package locally.
232
235
233
-
Inside the container, run `composer install`.
236
+
Inside the container:
234
237
235
-
Set up the environment: `cp .env.example .env`
238
+
1. Run `composer install`
239
+
2. Set up the environment: `cp .env.example .env`
236
240
237
-
Some tests hit the Cloud Tasks API and need a project and key to be able to hit it. See the variables in `.env`
241
+
Some tests use the Cloud Tasks API and require a project and credentials.
0 commit comments