Laravel dispatch plain json on queueHow do you implement a Stack and a Queue in JavaScript?Testing Laravel 4 Queue Faild jobs codeLaravel 5.1 failed queued jobs fails on failed() method, prevents queue failure event handler from being calledUsing the queue listener for xml messagesConsume raw json queue messages in LaravelArray to string conversion error in LaravelLaravel - Job dispatched on one server, handled on anotherLaravel queue listener from external servicePush to Laravel queue from outside Laravel (NodeJS)Laravel Exception explode() expects parameter 2 to be string, array given Illuminate/Queue/Jobs/Job.php:165
Was this pillow joke on Friends intentional or a mistake?
How did Apollo 15's depressurization work?
How to think about joining a company whose business I do not understand?
How can I support the recycling, but not the new production of aluminum?
How to setup a teletype to a unix shell
Would combining A* with a flocking algorithm be too performance-heavy?
Does Swashbuckler's Fancy Footwork apply if the attack was made with Booming Blade?
Is refusing to concede in the face of an unstoppable Nexus combo punishable?
The teacher logged me in as administrator for doing a short task, is the whole system now compromised?
Is it appropriate for a prospective landlord to ask me for my credit report?
Did the twin engined Lazair ultralight have a throttle for each engine?
!I!n!s!e!r!t! !n!b!e!t!w!e!e!n!
Is there a known non-euclidean geometry where two concentric circles of different radii can intersect? (as in the novel "The Universe Between")
Can you feel passing through the sound barrier in an F-16?
Starships without computers?
Does C++20 mandate source code being stored in files?
Why are delta bots so finicky?
Running script line by line automatically yet being asked before each line from second line onwards
What is the evidence on the danger of feeding whole blueberries and grapes to infants and toddlers?
Replace backtick ` with power ^ in math mode
What are the pros and cons of Einstein-Cartan Theory?
Are required indicators necessary for radio buttons?
Why were movies shot on film shot at 24 frames per second?
Can we save the word "unique"?
Laravel dispatch plain json on queue
How do you implement a Stack and a Queue in JavaScript?Testing Laravel 4 Queue Faild jobs codeLaravel 5.1 failed queued jobs fails on failed() method, prevents queue failure event handler from being calledUsing the queue listener for xml messagesConsume raw json queue messages in LaravelArray to string conversion error in LaravelLaravel - Job dispatched on one server, handled on anotherLaravel queue listener from external servicePush to Laravel queue from outside Laravel (NodeJS)Laravel Exception explode() expects parameter 2 to be string, array given Illuminate/Queue/Jobs/Job.php:165
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have 2 simple questions overall. Im currently looking into some event handling in Laravel and would like to use RabbitMQ as my event store. Therefor i installed this package to start with: https://github.com/php-enqueue/enqueue-dev
To get started i registered it and i am able to push messages on to RabbitMQ:
$job = (new Sendemail())->onQueue('email')->onConnection('interop');
dispatch($job);
The problem however is that Laravel pushes a certain format on the queue and i can't figure out how to change that. An example message would be:
"job":"Illuminate\\Queue\\CallQueuedHandler@call",
"data":
"command":"O:29:\"Acme\Jobs\FooJob\":4:s:11:\"fooBar\";s:7:\"abc-123\";s:5:\"queue\";N;s:5:\"delay\";N;s:6:\"\u0000*\u0000job\";N;"
So the question is, how can i change this? The main reason on this is that the consumer side is not even a PHP application which also can not interpret the PHP serialized model. Therefor im looking for a way to push a plain JSON object instead.
From the other hand i would also like to understand how you could build a custom listener? For the listener the same thing happens. Laravel tries to read the method but when i push plain JSON this will never work. Isn't there a way to register a handler on a topic and do further handling of the payload of the message within the handler itself?
php laravel queue
add a comment |
I have 2 simple questions overall. Im currently looking into some event handling in Laravel and would like to use RabbitMQ as my event store. Therefor i installed this package to start with: https://github.com/php-enqueue/enqueue-dev
To get started i registered it and i am able to push messages on to RabbitMQ:
$job = (new Sendemail())->onQueue('email')->onConnection('interop');
dispatch($job);
The problem however is that Laravel pushes a certain format on the queue and i can't figure out how to change that. An example message would be:
"job":"Illuminate\\Queue\\CallQueuedHandler@call",
"data":
"command":"O:29:\"Acme\Jobs\FooJob\":4:s:11:\"fooBar\";s:7:\"abc-123\";s:5:\"queue\";N;s:5:\"delay\";N;s:6:\"\u0000*\u0000job\";N;"
So the question is, how can i change this? The main reason on this is that the consumer side is not even a PHP application which also can not interpret the PHP serialized model. Therefor im looking for a way to push a plain JSON object instead.
From the other hand i would also like to understand how you could build a custom listener? For the listener the same thing happens. Laravel tries to read the method but when i push plain JSON this will never work. Isn't there a way to register a handler on a topic and do further handling of the payload of the message within the handler itself?
php laravel queue
something likedispatch(deserialize($job->getData()))
– YAMM
Mar 27 at 15:35
Dispatch requires an object. Deserialize is not a valid php function and the job has no getData method available?
– Dirkos
Mar 27 at 15:40
One other option to consider, since the main point of the Laravel Queue infrastructure is to have Laravel both send and process the jobs would to just use php-amqplib directly. You'd then have full control over what gets pushed onto the queue.
– Joshua Dwire
Mar 27 at 16:04
Depending on your language, there are libraries to deserialize something created by PHP's serialize function: npmjs.com/package/php-unserialize
– Joshua Dwire
Mar 27 at 16:07
add a comment |
I have 2 simple questions overall. Im currently looking into some event handling in Laravel and would like to use RabbitMQ as my event store. Therefor i installed this package to start with: https://github.com/php-enqueue/enqueue-dev
To get started i registered it and i am able to push messages on to RabbitMQ:
$job = (new Sendemail())->onQueue('email')->onConnection('interop');
dispatch($job);
The problem however is that Laravel pushes a certain format on the queue and i can't figure out how to change that. An example message would be:
"job":"Illuminate\\Queue\\CallQueuedHandler@call",
"data":
"command":"O:29:\"Acme\Jobs\FooJob\":4:s:11:\"fooBar\";s:7:\"abc-123\";s:5:\"queue\";N;s:5:\"delay\";N;s:6:\"\u0000*\u0000job\";N;"
So the question is, how can i change this? The main reason on this is that the consumer side is not even a PHP application which also can not interpret the PHP serialized model. Therefor im looking for a way to push a plain JSON object instead.
From the other hand i would also like to understand how you could build a custom listener? For the listener the same thing happens. Laravel tries to read the method but when i push plain JSON this will never work. Isn't there a way to register a handler on a topic and do further handling of the payload of the message within the handler itself?
php laravel queue
I have 2 simple questions overall. Im currently looking into some event handling in Laravel and would like to use RabbitMQ as my event store. Therefor i installed this package to start with: https://github.com/php-enqueue/enqueue-dev
To get started i registered it and i am able to push messages on to RabbitMQ:
$job = (new Sendemail())->onQueue('email')->onConnection('interop');
dispatch($job);
The problem however is that Laravel pushes a certain format on the queue and i can't figure out how to change that. An example message would be:
"job":"Illuminate\\Queue\\CallQueuedHandler@call",
"data":
"command":"O:29:\"Acme\Jobs\FooJob\":4:s:11:\"fooBar\";s:7:\"abc-123\";s:5:\"queue\";N;s:5:\"delay\";N;s:6:\"\u0000*\u0000job\";N;"
So the question is, how can i change this? The main reason on this is that the consumer side is not even a PHP application which also can not interpret the PHP serialized model. Therefor im looking for a way to push a plain JSON object instead.
From the other hand i would also like to understand how you could build a custom listener? For the listener the same thing happens. Laravel tries to read the method but when i push plain JSON this will never work. Isn't there a way to register a handler on a topic and do further handling of the payload of the message within the handler itself?
php laravel queue
php laravel queue
edited Mar 27 at 15:55
Joshua Dwire
4,9353 gold badges26 silver badges48 bronze badges
4,9353 gold badges26 silver badges48 bronze badges
asked Mar 27 at 15:27
DirkosDirkos
1791 gold badge1 silver badge18 bronze badges
1791 gold badge1 silver badge18 bronze badges
something likedispatch(deserialize($job->getData()))
– YAMM
Mar 27 at 15:35
Dispatch requires an object. Deserialize is not a valid php function and the job has no getData method available?
– Dirkos
Mar 27 at 15:40
One other option to consider, since the main point of the Laravel Queue infrastructure is to have Laravel both send and process the jobs would to just use php-amqplib directly. You'd then have full control over what gets pushed onto the queue.
– Joshua Dwire
Mar 27 at 16:04
Depending on your language, there are libraries to deserialize something created by PHP's serialize function: npmjs.com/package/php-unserialize
– Joshua Dwire
Mar 27 at 16:07
add a comment |
something likedispatch(deserialize($job->getData()))
– YAMM
Mar 27 at 15:35
Dispatch requires an object. Deserialize is not a valid php function and the job has no getData method available?
– Dirkos
Mar 27 at 15:40
One other option to consider, since the main point of the Laravel Queue infrastructure is to have Laravel both send and process the jobs would to just use php-amqplib directly. You'd then have full control over what gets pushed onto the queue.
– Joshua Dwire
Mar 27 at 16:04
Depending on your language, there are libraries to deserialize something created by PHP's serialize function: npmjs.com/package/php-unserialize
– Joshua Dwire
Mar 27 at 16:07
something like
dispatch(deserialize($job->getData()))
– YAMM
Mar 27 at 15:35
something like
dispatch(deserialize($job->getData()))
– YAMM
Mar 27 at 15:35
Dispatch requires an object. Deserialize is not a valid php function and the job has no getData method available?
– Dirkos
Mar 27 at 15:40
Dispatch requires an object. Deserialize is not a valid php function and the job has no getData method available?
– Dirkos
Mar 27 at 15:40
One other option to consider, since the main point of the Laravel Queue infrastructure is to have Laravel both send and process the jobs would to just use php-amqplib directly. You'd then have full control over what gets pushed onto the queue.
– Joshua Dwire
Mar 27 at 16:04
One other option to consider, since the main point of the Laravel Queue infrastructure is to have Laravel both send and process the jobs would to just use php-amqplib directly. You'd then have full control over what gets pushed onto the queue.
– Joshua Dwire
Mar 27 at 16:04
Depending on your language, there are libraries to deserialize something created by PHP's serialize function: npmjs.com/package/php-unserialize
– Joshua Dwire
Mar 27 at 16:07
Depending on your language, there are libraries to deserialize something created by PHP's serialize function: npmjs.com/package/php-unserialize
– Joshua Dwire
Mar 27 at 16:07
add a comment |
2 Answers
2
active
oldest
votes
There's a laravel-queue library that works with the php-enqueue library you linked to make it compatible with Laravel's built in queue system that Florian mentioned.
By default, it will still use a serialized object, but I think that can be overridden. If you look in Queue.php, createObjectPayload() on line 130 in the core Laravel Framework, that's where the job is being serialized.
If you extend the Queue class in the laravel-queue library, you should be able to change createObjectPayload to look something like this:
protected function createObjectPayload($job, $queue)
$payload = $this->withCreatePayloadHooks($queue, [
'displayName' => $this->getDisplayName($job),
'job' => 'IlluminateQueueCallQueuedHandler@call',
'maxTries' => $job->tries ?? null,
'timeout' => $job->timeout ?? null,
'timeoutAt' => $this->getJobExpiration($job),
'data' => [
'commandName' => $job,
'command' => $job,
],
]);
return array_merge($payload, [
'data' => [
'commandName' => get_class($job),
'command' => json_encode(clone $job),
],
]);
That should JSON encode the job data instead of serializing it. You may even be able to remove the encoding altogether, as I think it's already JSON encoded somewhere up the chain.
Seems logic somehow, let me try to implement something. I assume the same goes then for the listener (if i would build something in PHP right?) Since the fact in default expects a certain message format in this case which is Laravel specific
– Dirkos
Mar 27 at 15:59
@Dirkos If your listener is built in PHP, you'd be able to use the serialize function, so this wouldn't be an issue, right? If you're using a non-PHP listener, then you'd be writing from scratch anyway.
– Joshua Dwire
Mar 27 at 16:02
Yeah initially it will be PHP but will be translated later to other languages so. I also dont really like to bind my queues to specific framework implementations to be honest so guess its fine to decouple it now right away
– Dirkos
Mar 27 at 16:04
@Dirkos In that case, if you confirm something link my answer will work, consider keeping the serialize format until you decide to switch to a non-PHP processor. That will allow you to use the full Laravel Queue infrastructure for now and then just override the Queue class later when you're ready to switch.
– Joshua Dwire
Mar 27 at 16:06
add a comment |
Did you look at the Laravel solution for queues and jobs management ?
https://laravel.com/docs/5.5/queues
If yes, what are the reasons of your other choice ?
Laravel native does not support RabbitMQ for instance or any AMQP related protocols. The other reasons are that laravel on default pushes a full job class into the queue where i need a plain json object. However nothing to be found in the docs on how to handle that. As far as i understand the docs properly it is mostly build for handling internal events on an event bus where i have to publish events to a second consumer written in other languages
– Dirkos
Mar 27 at 15:46
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55380909%2flaravel-dispatch-plain-json-on-queue%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
There's a laravel-queue library that works with the php-enqueue library you linked to make it compatible with Laravel's built in queue system that Florian mentioned.
By default, it will still use a serialized object, but I think that can be overridden. If you look in Queue.php, createObjectPayload() on line 130 in the core Laravel Framework, that's where the job is being serialized.
If you extend the Queue class in the laravel-queue library, you should be able to change createObjectPayload to look something like this:
protected function createObjectPayload($job, $queue)
$payload = $this->withCreatePayloadHooks($queue, [
'displayName' => $this->getDisplayName($job),
'job' => 'IlluminateQueueCallQueuedHandler@call',
'maxTries' => $job->tries ?? null,
'timeout' => $job->timeout ?? null,
'timeoutAt' => $this->getJobExpiration($job),
'data' => [
'commandName' => $job,
'command' => $job,
],
]);
return array_merge($payload, [
'data' => [
'commandName' => get_class($job),
'command' => json_encode(clone $job),
],
]);
That should JSON encode the job data instead of serializing it. You may even be able to remove the encoding altogether, as I think it's already JSON encoded somewhere up the chain.
Seems logic somehow, let me try to implement something. I assume the same goes then for the listener (if i would build something in PHP right?) Since the fact in default expects a certain message format in this case which is Laravel specific
– Dirkos
Mar 27 at 15:59
@Dirkos If your listener is built in PHP, you'd be able to use the serialize function, so this wouldn't be an issue, right? If you're using a non-PHP listener, then you'd be writing from scratch anyway.
– Joshua Dwire
Mar 27 at 16:02
Yeah initially it will be PHP but will be translated later to other languages so. I also dont really like to bind my queues to specific framework implementations to be honest so guess its fine to decouple it now right away
– Dirkos
Mar 27 at 16:04
@Dirkos In that case, if you confirm something link my answer will work, consider keeping the serialize format until you decide to switch to a non-PHP processor. That will allow you to use the full Laravel Queue infrastructure for now and then just override the Queue class later when you're ready to switch.
– Joshua Dwire
Mar 27 at 16:06
add a comment |
There's a laravel-queue library that works with the php-enqueue library you linked to make it compatible with Laravel's built in queue system that Florian mentioned.
By default, it will still use a serialized object, but I think that can be overridden. If you look in Queue.php, createObjectPayload() on line 130 in the core Laravel Framework, that's where the job is being serialized.
If you extend the Queue class in the laravel-queue library, you should be able to change createObjectPayload to look something like this:
protected function createObjectPayload($job, $queue)
$payload = $this->withCreatePayloadHooks($queue, [
'displayName' => $this->getDisplayName($job),
'job' => 'IlluminateQueueCallQueuedHandler@call',
'maxTries' => $job->tries ?? null,
'timeout' => $job->timeout ?? null,
'timeoutAt' => $this->getJobExpiration($job),
'data' => [
'commandName' => $job,
'command' => $job,
],
]);
return array_merge($payload, [
'data' => [
'commandName' => get_class($job),
'command' => json_encode(clone $job),
],
]);
That should JSON encode the job data instead of serializing it. You may even be able to remove the encoding altogether, as I think it's already JSON encoded somewhere up the chain.
Seems logic somehow, let me try to implement something. I assume the same goes then for the listener (if i would build something in PHP right?) Since the fact in default expects a certain message format in this case which is Laravel specific
– Dirkos
Mar 27 at 15:59
@Dirkos If your listener is built in PHP, you'd be able to use the serialize function, so this wouldn't be an issue, right? If you're using a non-PHP listener, then you'd be writing from scratch anyway.
– Joshua Dwire
Mar 27 at 16:02
Yeah initially it will be PHP but will be translated later to other languages so. I also dont really like to bind my queues to specific framework implementations to be honest so guess its fine to decouple it now right away
– Dirkos
Mar 27 at 16:04
@Dirkos In that case, if you confirm something link my answer will work, consider keeping the serialize format until you decide to switch to a non-PHP processor. That will allow you to use the full Laravel Queue infrastructure for now and then just override the Queue class later when you're ready to switch.
– Joshua Dwire
Mar 27 at 16:06
add a comment |
There's a laravel-queue library that works with the php-enqueue library you linked to make it compatible with Laravel's built in queue system that Florian mentioned.
By default, it will still use a serialized object, but I think that can be overridden. If you look in Queue.php, createObjectPayload() on line 130 in the core Laravel Framework, that's where the job is being serialized.
If you extend the Queue class in the laravel-queue library, you should be able to change createObjectPayload to look something like this:
protected function createObjectPayload($job, $queue)
$payload = $this->withCreatePayloadHooks($queue, [
'displayName' => $this->getDisplayName($job),
'job' => 'IlluminateQueueCallQueuedHandler@call',
'maxTries' => $job->tries ?? null,
'timeout' => $job->timeout ?? null,
'timeoutAt' => $this->getJobExpiration($job),
'data' => [
'commandName' => $job,
'command' => $job,
],
]);
return array_merge($payload, [
'data' => [
'commandName' => get_class($job),
'command' => json_encode(clone $job),
],
]);
That should JSON encode the job data instead of serializing it. You may even be able to remove the encoding altogether, as I think it's already JSON encoded somewhere up the chain.
There's a laravel-queue library that works with the php-enqueue library you linked to make it compatible with Laravel's built in queue system that Florian mentioned.
By default, it will still use a serialized object, but I think that can be overridden. If you look in Queue.php, createObjectPayload() on line 130 in the core Laravel Framework, that's where the job is being serialized.
If you extend the Queue class in the laravel-queue library, you should be able to change createObjectPayload to look something like this:
protected function createObjectPayload($job, $queue)
$payload = $this->withCreatePayloadHooks($queue, [
'displayName' => $this->getDisplayName($job),
'job' => 'IlluminateQueueCallQueuedHandler@call',
'maxTries' => $job->tries ?? null,
'timeout' => $job->timeout ?? null,
'timeoutAt' => $this->getJobExpiration($job),
'data' => [
'commandName' => $job,
'command' => $job,
],
]);
return array_merge($payload, [
'data' => [
'commandName' => get_class($job),
'command' => json_encode(clone $job),
],
]);
That should JSON encode the job data instead of serializing it. You may even be able to remove the encoding altogether, as I think it's already JSON encoded somewhere up the chain.
edited Mar 27 at 15:57
answered Mar 27 at 15:51
Joshua DwireJoshua Dwire
4,9353 gold badges26 silver badges48 bronze badges
4,9353 gold badges26 silver badges48 bronze badges
Seems logic somehow, let me try to implement something. I assume the same goes then for the listener (if i would build something in PHP right?) Since the fact in default expects a certain message format in this case which is Laravel specific
– Dirkos
Mar 27 at 15:59
@Dirkos If your listener is built in PHP, you'd be able to use the serialize function, so this wouldn't be an issue, right? If you're using a non-PHP listener, then you'd be writing from scratch anyway.
– Joshua Dwire
Mar 27 at 16:02
Yeah initially it will be PHP but will be translated later to other languages so. I also dont really like to bind my queues to specific framework implementations to be honest so guess its fine to decouple it now right away
– Dirkos
Mar 27 at 16:04
@Dirkos In that case, if you confirm something link my answer will work, consider keeping the serialize format until you decide to switch to a non-PHP processor. That will allow you to use the full Laravel Queue infrastructure for now and then just override the Queue class later when you're ready to switch.
– Joshua Dwire
Mar 27 at 16:06
add a comment |
Seems logic somehow, let me try to implement something. I assume the same goes then for the listener (if i would build something in PHP right?) Since the fact in default expects a certain message format in this case which is Laravel specific
– Dirkos
Mar 27 at 15:59
@Dirkos If your listener is built in PHP, you'd be able to use the serialize function, so this wouldn't be an issue, right? If you're using a non-PHP listener, then you'd be writing from scratch anyway.
– Joshua Dwire
Mar 27 at 16:02
Yeah initially it will be PHP but will be translated later to other languages so. I also dont really like to bind my queues to specific framework implementations to be honest so guess its fine to decouple it now right away
– Dirkos
Mar 27 at 16:04
@Dirkos In that case, if you confirm something link my answer will work, consider keeping the serialize format until you decide to switch to a non-PHP processor. That will allow you to use the full Laravel Queue infrastructure for now and then just override the Queue class later when you're ready to switch.
– Joshua Dwire
Mar 27 at 16:06
Seems logic somehow, let me try to implement something. I assume the same goes then for the listener (if i would build something in PHP right?) Since the fact in default expects a certain message format in this case which is Laravel specific
– Dirkos
Mar 27 at 15:59
Seems logic somehow, let me try to implement something. I assume the same goes then for the listener (if i would build something in PHP right?) Since the fact in default expects a certain message format in this case which is Laravel specific
– Dirkos
Mar 27 at 15:59
@Dirkos If your listener is built in PHP, you'd be able to use the serialize function, so this wouldn't be an issue, right? If you're using a non-PHP listener, then you'd be writing from scratch anyway.
– Joshua Dwire
Mar 27 at 16:02
@Dirkos If your listener is built in PHP, you'd be able to use the serialize function, so this wouldn't be an issue, right? If you're using a non-PHP listener, then you'd be writing from scratch anyway.
– Joshua Dwire
Mar 27 at 16:02
Yeah initially it will be PHP but will be translated later to other languages so. I also dont really like to bind my queues to specific framework implementations to be honest so guess its fine to decouple it now right away
– Dirkos
Mar 27 at 16:04
Yeah initially it will be PHP but will be translated later to other languages so. I also dont really like to bind my queues to specific framework implementations to be honest so guess its fine to decouple it now right away
– Dirkos
Mar 27 at 16:04
@Dirkos In that case, if you confirm something link my answer will work, consider keeping the serialize format until you decide to switch to a non-PHP processor. That will allow you to use the full Laravel Queue infrastructure for now and then just override the Queue class later when you're ready to switch.
– Joshua Dwire
Mar 27 at 16:06
@Dirkos In that case, if you confirm something link my answer will work, consider keeping the serialize format until you decide to switch to a non-PHP processor. That will allow you to use the full Laravel Queue infrastructure for now and then just override the Queue class later when you're ready to switch.
– Joshua Dwire
Mar 27 at 16:06
add a comment |
Did you look at the Laravel solution for queues and jobs management ?
https://laravel.com/docs/5.5/queues
If yes, what are the reasons of your other choice ?
Laravel native does not support RabbitMQ for instance or any AMQP related protocols. The other reasons are that laravel on default pushes a full job class into the queue where i need a plain json object. However nothing to be found in the docs on how to handle that. As far as i understand the docs properly it is mostly build for handling internal events on an event bus where i have to publish events to a second consumer written in other languages
– Dirkos
Mar 27 at 15:46
add a comment |
Did you look at the Laravel solution for queues and jobs management ?
https://laravel.com/docs/5.5/queues
If yes, what are the reasons of your other choice ?
Laravel native does not support RabbitMQ for instance or any AMQP related protocols. The other reasons are that laravel on default pushes a full job class into the queue where i need a plain json object. However nothing to be found in the docs on how to handle that. As far as i understand the docs properly it is mostly build for handling internal events on an event bus where i have to publish events to a second consumer written in other languages
– Dirkos
Mar 27 at 15:46
add a comment |
Did you look at the Laravel solution for queues and jobs management ?
https://laravel.com/docs/5.5/queues
If yes, what are the reasons of your other choice ?
Did you look at the Laravel solution for queues and jobs management ?
https://laravel.com/docs/5.5/queues
If yes, what are the reasons of your other choice ?
answered Mar 27 at 15:44
Florian LaforgueFlorian Laforgue
1565 bronze badges
1565 bronze badges
Laravel native does not support RabbitMQ for instance or any AMQP related protocols. The other reasons are that laravel on default pushes a full job class into the queue where i need a plain json object. However nothing to be found in the docs on how to handle that. As far as i understand the docs properly it is mostly build for handling internal events on an event bus where i have to publish events to a second consumer written in other languages
– Dirkos
Mar 27 at 15:46
add a comment |
Laravel native does not support RabbitMQ for instance or any AMQP related protocols. The other reasons are that laravel on default pushes a full job class into the queue where i need a plain json object. However nothing to be found in the docs on how to handle that. As far as i understand the docs properly it is mostly build for handling internal events on an event bus where i have to publish events to a second consumer written in other languages
– Dirkos
Mar 27 at 15:46
Laravel native does not support RabbitMQ for instance or any AMQP related protocols. The other reasons are that laravel on default pushes a full job class into the queue where i need a plain json object. However nothing to be found in the docs on how to handle that. As far as i understand the docs properly it is mostly build for handling internal events on an event bus where i have to publish events to a second consumer written in other languages
– Dirkos
Mar 27 at 15:46
Laravel native does not support RabbitMQ for instance or any AMQP related protocols. The other reasons are that laravel on default pushes a full job class into the queue where i need a plain json object. However nothing to be found in the docs on how to handle that. As far as i understand the docs properly it is mostly build for handling internal events on an event bus where i have to publish events to a second consumer written in other languages
– Dirkos
Mar 27 at 15:46
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55380909%2flaravel-dispatch-plain-json-on-queue%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
something like
dispatch(deserialize($job->getData()))
– YAMM
Mar 27 at 15:35
Dispatch requires an object. Deserialize is not a valid php function and the job has no getData method available?
– Dirkos
Mar 27 at 15:40
One other option to consider, since the main point of the Laravel Queue infrastructure is to have Laravel both send and process the jobs would to just use php-amqplib directly. You'd then have full control over what gets pushed onto the queue.
– Joshua Dwire
Mar 27 at 16:04
Depending on your language, there are libraries to deserialize something created by PHP's serialize function: npmjs.com/package/php-unserialize
– Joshua Dwire
Mar 27 at 16:07