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
Some of drivers support priority queues. But priority values for different drivers are not compatible.
I used DB driver and had this code for high priority tasks:
Yii::$app->queue->priority(0)->push($someJob);
By default DB driver sets priority to 1024 and lesser value means higher priority.
Now I move to AMQP Interop driver (RabbitMQ). And I have to rewrite my code for high priority jobs:
Yii::$app->queue->priority(10)->push($someJob);
AMQP Interop maximum priority is 10 by default and higher value means higher priority.
As I see Gearman also supports priorities
PRIORITY
METHOD
0
doHighBackground()
1
doBackground()
2
doLowBackground()
I understand that priority value depends on driver. But I'd like to have scalable system and I'd like to have ability to change driver without code rewriting. I propose to add three common priorities to driver classes.
It looks like as syntactic sugar to me. Moreover, some brokers aren't support message priorities. This will not work with amqp, file, redis and sqs drivers.
Some of drivers support priority queues. But priority values for different drivers are not compatible.
I used DB driver and had this code for high priority tasks:
By default DB driver sets priority to 1024 and lesser value means higher priority.
Now I move to AMQP Interop driver (RabbitMQ). And I have to rewrite my code for high priority jobs:
AMQP Interop maximum priority is 10 by default and higher value means higher priority.
As I see Gearman also supports priorities
I understand that priority value depends on driver. But I'd like to have scalable system and I'd like to have ability to change driver without code rewriting. I propose to add three common priorities to driver classes.
And use code like
Or something like this.
The text was updated successfully, but these errors were encountered: