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
If you want jobs to be processed by Cloud Run Jobs instead of HTTP endpoints, you can configure the queue to trigger Cloud Run Job executions.
109
+
110
+
#### Why Cloud Run Jobs?
111
+
112
+
Cloud Run Jobs are ideal for long-running batch processing that exceeds Cloud Tasks HTTP timeout limits.
113
+
114
+
Cloud Run Jobs can run for up to 7 days.
115
+
116
+
**Tip**: Use seperate queue connections with different targets, for low latency jobs, use HTTP targets, for longer running batch jobs use Cloud Run Jobs.
117
+
118
+
#### Setup
119
+
120
+
1.**Create a Cloud Run Job** with your Laravel application container, configured to run:
121
+
122
+
```bash
123
+
php artisan cloud-tasks:work-job
124
+
```
125
+
126
+
The command reads job data from environment variables passed to the Job by Cloud Run.
> **Note**: The command reads `CLOUD_TASKS_PAYLOAD`, `CLOUD_TASKS_TASK_NAME`, and `CLOUD_TASKS_PAYLOAD_PATH` directly from environment variables at runtime using `getenv()`. These are set automatically by Cloud Tasks via container overrides.
151
+
152
+
3.**Set environment variables**:
153
+
154
+
```dotenv
155
+
CLOUD_TASKS_USE_CLOUD_RUN_JOB=true
156
+
CLOUD_RUN_JOB_NAME=my-queue-worker-job
157
+
CLOUD_RUN_JOB_REGION=europe-west1
158
+
```
159
+
160
+
#### Large Payload Storage
161
+
162
+
For jobs with payloads exceeding environment variable limits (32KB limit enforced by Cloud Run), configure a Laravel filesystem disk:
163
+
164
+
```dotenv
165
+
CLOUD_TASKS_PAYLOAD_DISK=gcs
166
+
CLOUD_TASKS_PAYLOAD_PREFIX=cloud-tasks-payloads
167
+
CLOUD_TASKS_PAYLOAD_THRESHOLD=30000
168
+
```
169
+
170
+
When the payload exceeds the threshold, it's stored in the disk and `CLOUD_TASKS_PAYLOAD_PATH` is used instead.
171
+
172
+
> **Note**: The payloads will not be cleared up automatically, you can define lifecycle rules for the GCS bucket to delete old payloads.
173
+
174
+
#### How It Works
175
+
176
+
When you dispatch a job with Cloud Run Job target enabled:
177
+
178
+
1. Package creates a Cloud Task with HTTP target pointing to Cloud Run Jobs API
0 commit comments