Replies: 1 comment
-
We (at @glowingblue) use it to push job to a queue worker (the jobs are stored in Redis). Those jobs are implemented in a generic way and therefore, to process the data we always need to pass a Closure that describes the part of the processing that cannot be generalized. It's usually a very short and simple function that has to serialized. Examples: $eventCallbacks = [
'getUserId' => fn ($event) => $event->discussion->user_id,
'getDate' => fn ($event) => $event->discussion->created_at,
]; or $queue->push(new AddPendingActivitiesJob(
null,
fn () => $eventRecord?->event?->state?->user_id,
fn () => $eventRecord?->created_at,
$describerKey,
)); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I just wanted to ask for a few examples of what you use the library for in real life. Why do you need to serialize closures? I can see some drawbacks:
What are the advantages? When do you use it? Thank you very much.
Beta Was this translation helpful? Give feedback.
All reactions