Symfony Messenger 4.3

Symfony Messenger 4.3

Introduction to Symfony Messenger with a focus on the new features from the Symfony 4.3 release such as the new transports, retry strategies and handling failed messages.

6a1345d8e6dd15b2c78eff0c331963b1?s=128

Denis Brumann

July 11, 2019
Tweet

Transcript

  1. 1.

    Symfony Messenger 4.3 Symfony User Group Köln Von Thomas Wolf,

    www.foto-tw.de, CC BY-SA 3.0 de, https://commons.wikimedia.org/w/index.php?curid=62082470
  2. 4.
  3. 5.
  4. 6.
  5. 7.
  6. 9.

    Bus

  7. 10.
  8. 11.
  9. 12.
  10. 13.
  11. 14.
  12. 16.
  13. 18.
  14. 20.
  15. 21.
  16. 22.
  17. 25.
  18. 27.
  19. 28.
  20. 29.
  21. 31.
  22. 33.

    Usage: messenger:consume [options] [--] [<receivers>...] messenger:consume-messages Arguments: receivers Names of

    the receivers/transports to consume in order of priority [default: ["async"]] Options: -l, --limit=LIMIT Limit the number of received messages -m, --memory-limit=MEMORY-LIMIT The memory limit the worker can consume -t, --time-limit=TIME-LIMIT The time limit in seconds the worker can run --sleep=SLEEP Seconds to sleep before asking for new messages after no messages were found [default: 1] -b, --bus=BUS Name of the bus to which received messages should be dispatched (if not passed, bus is determine automatically.
  23. 36.

    framework: messenger: ... # default configuration retry_strategy: max_retries: 3 delay:

    1000 # delay for first retry multiplier: 2 # multiply delay with each try max_delay: 0 # service: null # id for custom RetryStrategy
  24. 40.
  25. 46.
  26. 47.
  27. 48.
  28. 53.

    Which Handler processes a message? name: 'messenger.message_handler', handles: '*', #

    which message(s) to handle bus: 'event_bus', # restrict handler to specific bus method: 'handleEvent', # method to be called on handler priority: 1, # prioritize handler over others from_transport: 'async', # handle only received messages
  29. 56.

    Which bus is injected into a service? framework: messenger: default_bus:

    'first_bus' buses: first_bus: middleware: - 'messenger.middleware.validation' second_bus: ...
  30. 57.

    Which bus is injected into a service? services: _defaults: bind:

    $firstBus: 'first_bus' $secondBus: 'second_bus'
  31. 59.