Closed snezhkoigor closed 5 years ago
`
$job = new OptimizerPositioningRequestJob();
$this->dispatch($job);
return response()->json([
'data' => [
'channel' => $channel,
'reference_points' => $through_cities,
'way_points' => $way_points
]
], Response::HTTP_OK);
`
In OptimizerPositioningRequestJob I send message, so response()->json has extra text
Now I've redeclared Producer class with method send
Sure, whenever a message is sent to the queue, a notification is printed in terminal. That is being returned along with your JSON response.
You should surround the function to send the message by ob_start()
and ob_end_clean()
to discard the output.
ob_start();
$producer->send($exchange, $payload);
$ob_end_clean();
On a side note, please change the issue title to reflect what the actual issue is; to improve its discoverability for others.
Thanks.
Thank you so much!
Hi. I have some problem with row 123 in file Producer.php
echo ' [x] Data Package Sent to ', $this->exchangeName, ' Exchange!', "\n";
When I'm trying send something to frontend after $producer->send(...) every time I have extra text in response.
My case - I send message to RabbitMQ, generate uniq channel id and send channel to frontend.