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

Skip to content

[Messenger] messenger:consume offers sync transports to consume from and then immediately throws an exception #51556

Closed
@dkarlovi

Description

@dkarlovi

Symfony version(s) affected

6.3.3

Description

When running messenger:consume without a transport, it asks to select which transport to consume from.

$ bin/console messenger:consume

                                                                                                                        
 Which transports/receivers do you want to consume?                                                                     
                                                                                                                        

Choose which receivers you want to consume messages from in order of priority.
Hint: to consume from multiple, use a list of their names, e.g. async, default

 Select receivers to consume: [async]:
  [0] async
  [1] default

But, if I select default (which is sync), it immediately throws

In SyncTransport.php line 37:
                                                                 
  You cannot receive messages from the Messenger SyncTransport.  
                                                                 

making this choice superfluous because the only possible selection is async.

How to reproduce

See above.

Possible Solution

Filter out sync transports and, if only one item remains, consume that immediately.

Additional Context

I guess this could be considered an UX bug.

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