Closed amanformuli closed 1 year ago
Hey @amanformuli!
First of all I appreciate your work.
Thank you :)
Secondly, is it possible to add a separate public method...
I guess you mean something like ->sendSerialized(string $data)
and the transport decodes this $data before actually calling ->send()
?
Hi Kevin,
Indeed I asked for such method with only one thing: is it possible to keep the $data type as an array so that both the headers and body of the message is passed. If the send method does not do anything with the headers, then string $data would be fine.
Thanks
is it possible to keep the $data type as an array
I will need to use the transport's configured serializer to decode the message - this does indeed require an array (I thought it was a string) so yes, sendSerialized()
should be able to take an array.
BTW, can you describe your use case for this? I don't think it's invalid, I'd like to describe why you'd do this in the docs for this feature.
Actually I am using symfony serializer(configured to my symfony messenger) and wanted to test the message with json format instead of Object class.
Got it, would it be valuable to for TestTransport::send()
to accept a json string in addition to a decoded json array?
Yeah that is also fine to accept a json string.
Hi All,
First of all I appreciate your work. Secondly, is it possible to add a separate public method(in Zenstruck\Messenger\Test\Transport\TestTransport) to send with deserialized data so that a JSON data type is passed as parameter? { 'headers' => [ 'type' => 'Class' ], 'body' => '{"serialized":"data}' }
Thanks