Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Messenger] RedisTransport can not use both DSN and preconfigured parameters #39834

Closed
@edefimov

Description

@edefimov

Symfony version(s) affected: >=5.1.0

Description
Trying to configure redis transport in messenger component via both framework bundle configuration framework.messenger.transports.*.options and query parameters in DSN leads to drop of options defined in framework.messenger.transports.*.options.

How to reproduce

  1. Configure messenger bundle as follows:
framework:
    messenger:
        transports:
            tasks:
                dsn: '%env(APP_REDIS_DSN)%'
                options:
                    stream: my.tasks
                    group: app
                    consumer: app
                    delete_after_ack: true
  1. Define env variable APP_REDIS_DSN with query string
APP_REDIS_DSN=redis://localhost?dbindex=2
  1. Start a consumer
bin/console messenger:consume tasks
  1. As a result only dbindex=2 will be passed into redis Connection. Parameters from framework.messenger.transports.tasks.options are lost

Possible Solution
Replace this line with

parse_str($parsedUrl['query'], $queryOptions);
$redisOptions += $queryOptions;

Additional context

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions