Conversation
Signed-off-by: Tihomir Surdilovic <tihomir@temporal.io>
|
|
||
| @Override | ||
| public void makePurchaseValidator(Purchase purchase) { | ||
| if (!activities.isProductInStockForPurchase(purchase)) { |
There was a problem hiding this comment.
Local activities cannot be run in validators
There was a problem hiding this comment.
they have the same restriction as queries
There was a problem hiding this comment.
it works as in it gets called ok. didnt see failure
There was a problem hiding this comment.
it is not supported and It will not replay correctly
There was a problem hiding this comment.
We'll likely not support local activities in validators but there has been talk of adding a different concept to SDKs which is backed by activities but doesn't generate history events that can be used in both query handlers and update validators.
There was a problem hiding this comment.
We should throw in Java (and Go) if any commands are being generated in query handlers and update validators (and side-effects FTR).
There was a problem hiding this comment.
ok. should we then open issue for it in java sdk to throw error and not allow temporal apis?
Yes, we already do
just wanted to add, having to throw TemporalFailure from update handler is weird
Do you have a suggestion on how you would implement it differently? I think the issue is your thinking of the update handler as part of the workflow like signal, but really its another sub request running inside a workflow that can succeed/fail on its own.
There was a problem hiding this comment.
I think if its possible to have a specific error idk like RejectUpdateException or something like that would be easier for users to understand (and if you throw TemporalFailure for it to still fail workflow if user really wants to do that for some reason).
There was a problem hiding this comment.
So that doesn't really work because if you ran an activity in a update handle and it failed by default if would fail your whole workflow instead of just your update request.
Signed-off-by: Tihomir Surdilovic <tihomir@temporal.io>
|
@Quinn-With-Two-Ns made all the updates let me know if its ok to get this in now (sorry im asking just have a Kafka sample coming in and wanted to get this merged fist if possible :) ) |

Sync Update SpringBoot Sample
This sample shows how to use update feature. Uses jpa and h2 in-memory db for the inventory.
User can enter a fishing item to purchase from inventory and define the amount.
The update validator checks if inventory has item and the amount (local activity)
The update then updates the db (local activity).
If amount you wan to purchase is > than whats in inventory the validator fails and shows message.
On success purchase the inventory table is updated dynamically..
(this pr also includes small changes to other sample html pages, like using fragments for header and footer)