Re:Introduction to Simple Workflow Service (SWF)
by mfateev on Wednesday July 15, 2020 @12:02PM
(#23847171)
The article is pretty naive. It writes code against the low level API which was never intended for workflow writers and then complains that it is too complicated. He had to use the high level library (https://docs.aws.amazon.com/amazonswf/latest/awsrbflowguide/...) instead.
It is like writing assembler code against raw Linux kernel systems calls while Python is available and complaining that Linux is too hard to use.
Look at the temporal.io samples which give you completely different view of how such code should look like. For example the money transfer sample (taken from https://github.com/temporalio/java-samples/blob/master/src/m...):
```
public class AccountTransferWorkflowImpl implements AccountTransferWorkflow {
private final ActivityOptions options =
ActivityOptions.newBuilder().setStartToCloseTimeout(Duration.ofSeconds(5)).build();
private final Account account = Workflow.newActivityStub(Account.class, options);
@Override
public void transfer(
String fromAccountId, String toAccountId, String referenceId, int amountCents) {
account.withdraw(fromAccountId, referenceId, amountCents);
account.deposit(toAccountId, referenceId, amountCents);
}
}
```
Re:Introduction to Simple Workflow Service (SWF)
by gtsteve on Wednesday July 15, 2020 @08:44AM
(#23844346)
The main thing I liked about SWF was that the entire workflow was represented in my own code. We ended up cloning the parts of SWF we used when we had to deploy outside AWS. The decider/actor pattern is a great pattern and I'd definitely use it again.
However, as you say, the 'Simple' part is definitely a misnomer.
Re:Introduction to Simple Workflow Service (SWF)
by mfateev on Wednesday July 15, 2020 @11:44AM
(#23846867)
Look at temporal.io. I believe we managed to get rid of the original SWF rough edges while maintaining the "workflow as code" approach. And the best part is that it is open source and you can run it anywhere yourself.
Re:Introduction to Simple Workflow Service (SWF)
by lukerohde on Wednesday July 15, 2020 @05:55PM
(#23852581)
What is the relationship between this project and uber/cadence? I see you have worked on both and they seem very similar/the same.
> Using SWF turned out to be a lot more complicated than I expected. Having to parse all to events to figure out which activity goes next, seems error prone and makes the code confusing. The documentation is also not very clear on how this should be done, so hopefully this example helps people interested.
That's the only point in this article you need to know. SWF was a great stepping stone towards something better, but wow I wouldn't dare build anything new on it today.