SYMFONY 5.2 : .env variable in messenger.yaml configuration

1.7k Views Asked by At

Is there any way to use .env variable in messenger routing?

For example, this configuration:

framework:
   messenger:
       transports:
           test: '%env(MESSENGER_TRANSPORT_DSN_TEST)%'
           test1: '%env(MESSENGER_TRANSPORT_DSN_TEST_1)%'
           other: '%env(MESSENGER_TRANSPORT_DSN_OTHER)%'

       routing:
           'App\Message\Oss': '%env(json:ROUTING_OSS)%'

give me this error:

In Compiler.php line 108:                                                                                             
  Incompatible use of dynamic environment variables "json:ROUTING_OSS" found in parameters.                                                                                            

In FrameworkExtension.php line 1864:                                                                                                                                                                                   
  Invalid Messenger routing configuration: the "App\Message\Oss" class is being routed to a sender called "%env(json:ROUTING_OSS)%". This is not a valid transport or service id. 
0

There are 0 best solutions below