Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
rauanmayemir opened this issue May 8, 2023 · 0 comments · Fixed by roadrunner-server/amqp#95
Assignees
Labels
C-feature-request Category: feature requested, but need to be discussed
Milestone

Comments

@rauanmayemir
Copy link

Plugin

JOBS

I have an idea!

Currently we specify all the AMQP parameters in the pipeline config like so:

jobs:
  pipelines:
    my_amqp_pipeline:
      driver: amqp
      config:
        prefetch: 10
        priority: 1
        durable: true
        queue: my_amqp_queue_1
        exchange: amqp.direct
        exchange_durable: true
        routing_key: my_amqp_queue_1
        requeue_on_fail: true

On the spiral side, I can only specify my_amqp_pipeline pipeline name as a destination options (alongside delay, but it's irrelevant). It would make sense for basic setup, but AMQP usually requires two parameters: exchange name and routing key.

In my case it's just a 'direct' exchange with underlying queues bound by name, i.e a single exchange but lots of my_amqp_queue_1, my_amqp_queue_2, my_amqp_queue_3. Other use cases of rabbitmq could also involve fanouts, where I could be sending a wildcard pattern as a routing key destination.

It would be nice to be able to dynamically specify custom routing_key on the spiral side (with a fallback to default routing_key in the pipeline config). E.g:

/** @var QueueInterface $queue */
$queue->push(
    JobPayload::class,
    $payload,
    (new Options())
        ->onQueue('my_amqp_pipeline')
        // would fallback to `my_amqp_queue_1` as per config if not set, i.e null
        ->withRoutingKey('my_amqp_queue_3')
        ->withDelay(20)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: feature requested, but need to be discussed
Projects
No open projects
Status: Unreleased
Status: SPRINT-21AUG-18SEP
Development

Successfully merging a pull request may close this issue.

2 participants