-
-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do payloads have to be JSON? #56
Comments
@Xachman you're right, json is required format. I'll add this requirement to documentation and think how to validate payload. |
@Xachman one question: when you publish data, you need to pass a php array to |
The other service is not laravel. I was just publishing messages for testing. The frontend application is laravel and the backend will be python consuming messages from the laravel application and publishing other messages. Knowing the expected format here is important so these 2 applications can communicate. |
OK. The package expects that messages are published and handled by their methods, so your flow didn't expected. Please suggest the best part of doc where I should add notice about format and I'll add it. |
I think in the listeners section it should be noted since this is where it applies and will fail. In my tests what would happen is the payload was not even passed in if it was not json. You get the 1 argument expected none passed in error. So its not really clear here what the expectation is of the Listener payload is just that it's usually an array. Tho I cant see what case it would not be an array since it's using the type in the parameter. |
@Xachman The documentation has been updated. Is it clear now? |
This definitely helps! I think this information on how payloads are interpolated is beneficial even in a standard use case. I'm not going to be too picky about this tho my project is working knowing that the expected format is json. |
Ok, thank you for your help. I close the issue. |
In the Queue\Job class it uses the payload function from \Illuminate\Queue\Jobs\Job. This function returns json and if the payload in rabbitmq is not json it returns null. When this happens you will get a too few arguments error on your listener classes handle function.
If its expected that we will always be using json can we add that to the documentation? Otherwise we should implement this so other none json data can be stored and passed along.
The text was updated successfully, but these errors were encountered: