spiral / roadrunner-bridge

🌉 RoadRunner bridge to Spiral Framework
https://spiral.dev/docs/packages-roadrunner-bridge
MIT License
12 stars 6 forks source link

[queue] Payload Type Detector for Enhanced Payload Data Deserialization #81

Closed butschster closed 8 months ago

butschster commented 1 year ago

This pull request introduces a new feature to enhance payload data deserialization by implementing a payload type detector.

Oftentimes, when pushing a job into a queue, there are cases where the payload type is unknown, leading to incorrect deserialization by the serializer. This can occur when the consumer lacks a class with the specified name provided in the headers. To address this issue, we have introduced a mechanism to detect the payload type by leveraging the job handler and extracting the payload type from the payload argument within the invoke method.

The new payload type detector offers flexibility for future enhancements by enabling the addition of more detectors, such as utilizing attributes or getting payload type from config related with given job name. This extensibility ensures that the payload type can be accurately determined, even in complex scenarios.

codecov[bot] commented 1 year ago

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (2cf49a9) 92.87% compared to head (f47cd1a) 93.02%.

Files Patch % Lines
src/Queue/PayloadDeserializer.php 97.67% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## 3.x #81 +/- ## ============================================ + Coverage 92.87% 93.02% +0.14% - Complexity 316 335 +19 ============================================ Files 62 63 +1 Lines 1010 1046 +36 ============================================ + Hits 938 973 +35 - Misses 72 73 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.