4 ms·
hey! so we actually have a React + Temporal example: https://github.com/temporalio/samples-typescript/tree/main/nextjs-ecommerce-oneclick https://github.com/tem
by swyx 5y ago
hey! so we actually have a React + Temporal example: https://github.com/temporalio/samples-typescript/tree/main/nextjs-ecommerce-oneclick https://github.com/temporalio/samples-typescript/tree/main/n... (9 minute demo/talk here: https://www.youtube.com/watch?v=WRYozSljSpw https://www.youtube.com/watch?v=WRYozSljSpw)
when you are handling your customers' states, every purchase is a long running process, both from an ordering side and a fulfilment perspective. Work needs to be done asynchronously, or you need to wait for some condition to be met to proceed, etc. Temporal makes it so that you don't have to glue together a bunch of schedulers and queues and databases and ad hoc state machines to make that work, make it traceable/debuggable, and make that scale.
Your engineers would be able to translate your business requirements directly into workflow code (often just a function) and be able to version control, test, migrate, lint, etc, rather than have that logic spread out over a bunch of your code and infra structure. they would then register it with their Temporal workers, and then invoke/signal those workflows from your php/node/whatever application code.
i did a demo recently of what its like to translate product specs to a workflow, like @rrix is saying in another comment, its pretty fun! https://www.youtube.com/watch?v=2pxZgGhT-Xo https://www.youtube.com/watch?v=2pxZgGhT-Xo
- machiaweliczny 5y agoDoes temporal have ability to handle new input? For example someone did chargeback while my delivery workflow is running. Do I have to add guards everywhere for this? With event based system I would just set order=canceled and then for example cron to deliver stuff via email would not pick it up.
- swyx 5y agoyeah use signals https://docs.temporal.io/docs/typescript/workflows#signals-and-queries https://docs.temporal.io/docs/typescript/workflows#signals-a... example usage in a billing workflow https://docs.temporal.io/docs/typescript/subscription-tutorial https://docs.temporal.io/docs/typescript/subscription-tutori...
- machiaweliczny 5y agoThanks. I guess I could have activity to set user.hasAccess=false when I get cancel signal. I wonder how such long running workflows can be updated due to business requirements change. Say we now want to have longer trial period (so something that is not externalized via activity, like email wording for example).
- swyx 5y agoyeah, use versioning! https://docs.temporal.io/docs/typescript/patching https://docs.temporal.io/docs/typescript/patching its not the simplest thing to do, and we have plans to make it simpler, but patching long running work while it is still running is inherently tricky. the good news is that at least we have a versioning story (and the failure mode is stopped progress) rather than handrolled systems which basically have “deploy and pray” strategies