-
-
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
Cannot use finally method of Laravel Batch Job inside an Activity #91
Comments
Hi |
Yes, I already used However, do you know why the serialization is broken when using Batch with Workflow? Right now, I have to override the protected function serialize($value): string
{
return Y::serialize($value);
}
protected function unserialize($serialized): mixed
{
return Y::unserialize($serialized);
} |
It sounds like you found a workaround. Is this still a blocker for you? |
@phuclh I have figured out the issue. A fix is coming soon. However you can do this part... ->finally(function () use ($id) {
$workflow = StoredWorkflow::find($id);
WorkflowStub::fromStoredWorkflow($workflow)->setReady(true);
}) like this instead... ->finally(function () use ($id) {
WorkflowStub::load($id)->setReady(true);
}) And it will be simpler for you. |
Nice, thank you for the simpler solution. Have you had a chance to look at the issue when serialization is broken when using Batch with Workflow? Right now, I have to override the protected function serialize($value): string
{
return Y::serialize($value);
}
protected function unserialize($serialized): mixed
{
return Y::unserialize($serialized);
} |
@phuclh Yes sir, I figured it out. I have a PR coming to fix it in the next release. 🎉 |
Great. Thank you so much 👍😊 |
I have a batch job that is dispatched in an Activity. When the batch job is finished, I would like to trigger the Workflow to fire the next Activity. However, I got an error when using
finally
method.Here is my Activity code:
Here is my Workflow code:
Updated: Seems this is an error of Laravel, not this package. If I use
$this
inside thefinally
method, it will throw that error. So here is the walkaround:However, there is something wrong with serializing the
options
column injob_batches
table. When I runBus::findBatch($batchID)
, it throw this error.Probably, the Larvel serializing was conflicted with the Workflow serializing.
The text was updated successfully, but these errors were encountered: