roadrunner-php / issues

Home for the RoadRunner-PHP issues and discussions ❤️
MIT License
2 stars 0 forks source link

[💡 FEATURE REQUEST]: Allow setting `routing_key` dynamically when publishing a job to a pipeline #7

Closed rustatian closed 9 months ago

rustatian commented 1 year ago

Description

This is a reference to the original ticket for the per-message routing_key implementation: https://github.com/roadrunner-server/roadrunner/issues/1555

Planning to include in the RR v2023.3.0. CC: @rauanmayemir

rustatian commented 1 year ago

The routing_key should be in the headers that JOBS client sends to the RR. Key -> x-routing-key, value -> routing key (string). This change is for the amqp driver only. RR will check for this key and send data to the queue with the provided routing key.

msmakouz commented 9 months ago

Closed by: https://github.com/roadrunner-php/jobs/pull/58

Usage example:

use Spiral\RoadRunner\Jobs\Queue\AMQP\Header;

/** @var QueueInterface $queue */
$queue->push(
    JobPayload::class,
    $payload,
    (new Options())
        ->onQueue('my_amqp_pipeline')
        ->withHeader(Header::ROUTING_KEY, '...') 
        ->withDelay(20)
);