Replies: 5 comments 1 reply
-
I'd like to see ability to specify url per queue too. We're actually running a fork because of this reason. It was my colleague that implemented this so I'm not yet familiar with how we do it, but I'd be willing to investigate and help contribute. |
Beta Was this translation helpful? Give feedback.
-
Thanks! I'm open to all ideas, and I'm interested to know: What is the reasoning for having different endpoints for jobs? Is it, so a job can be dispatched on app A, but be handled by app B? Some examples/use-cases would help!
Some examples would help here too. I'm currently working on use Illuminate\Queue\Queue;
Queue::connection()->setTaskHeaders(fn (array $job) => [
'X-My-Header' => $job['displayName']
]); Would that solve that problem? Anyway, love to hear more. Thanks! |
Beta Was this translation helpful? Give feedback.
-
Using different routes per queue lets us route tasks to differently sized containers. Some tasks are simple and fast so they don't need as much processing power as others. This lets us save on costs too. Another benefit is being able to query our logs by request url to see logs from a specific queue. |
Beta Was this translation helpful? Give feedback.
-
Basically exactly the same 2 use cases that @Plytas mentions, I'm having as well. A configurable As I said, I'm more than happy to contribute or help in some way, but I didn't want to 'push' it without consulting first. |
Beta Was this translation helpful? Give feedback.
-
Sounds like a great idea. Feel free to make a PR with the changes. Can you please make them against the Thinking of it, if we're doing this on a by-job basis, it might make more sense to have the headers also be a by-job basis... Something like: class ProcessPodcast implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public $tries = 3;
public function handle()
{
// ...
}
public function taskHandlerUrl(): string
{
// ...
}
public function taskHeaders(): array
{
return [
'X-My-Header' => 'My-Value',
];
}
} Doing it through the 'cloudtasks' => [
'handler' => env('STACKKIT_CLOUD_TASKS_HANDLER', ''),
'service_account_email' => env('STACKKIT_CLOUD_TASKS_SERVICE_EMAIL', ''),
'signed_audience' => env('STACKKIT_CLOUD_TASKS_SIGNED_AUDIENCE', true),
// The default handler
'handler' => env('STACKKIT_CLOUD_TASKS_HANDLER'),
// Queue specific handlers
'queue_handlers' => [
'low_performance' => env('STACKKIT_CLOUD_TASKS_LOW_PERF_HANDLER', env('STACKKIT_CLOUD_TASKS_HANDLER')),
'high_performance' => env('STACKKIT_CLOUD_TASKS_HIGH_PERF_HANDLER', env('STACKKIT_CLOUD_TASKS_HANDLER')),
]
],
ResourceHeavyJob::dispatch()->onQueue('high_performance'); |
Beta Was this translation helpful? Give feedback.
-
This package is very nice, and I use it with great pleasure. However, I got to ask: why is the handler url always fixed at
/handle-task
? Personally, I would like to be able to overwrite this with my own handle-task endpoint, pass additional query-parameters etcetera. Also, I would like to have a different handler for different jobs. As of now, I'm forced to overwrite the config value, which doesn't quite feel right.I'm happy to make a pull request with a change for this. Perhaps by checking if a method exists on the job and call that method? And fall back to
/handle-task
, to make it backwards compatible.I'm wondering if there is a specific reason for this not to be adjustable, and if you'd be willing to look into (and merge) such a feature?
Beta Was this translation helpful? Give feedback.
All reactions