3 ms·
The article is discussing documentation for the AWS Flow Framework specifically. The Flow Framework is a Java framework built on top of the SWF API, and it prov
by jcrites 11y ago
The article is discussing documentation for the AWS Flow Framework specifically. The Flow Framework is a Java framework built on top of the SWF API, and it provides a completely different programming model than the SWF API.
The C# example being discussed, as well as the Java example at the end, are examples of using that SWF API directly. The SWF API is indeed simpler for trivial examples. Flow is a power tool that handles complex workflows better than any alternative I've seen, but the framework itself is complex and incurs cost to set up and use. The documentation could do a better job of explaining this, and of providing Java API examples.
The Flow framework provides something that's a mix of Java code and a domain-specific language for building SWF applications that's expressed as Java code. (For an analogy, consider EasyMock.) It's hard to explain Flow concisely, but if I had to try I'd say, "You write code that looks like it's procedural and runs on one machine, and Flow converts that into a distributed workflow running across of fleet of machines, all of which may be stateless". Flow threads the state into and out of SWF for you, making it possible to express distributed workflows at a higher level of abstraction. Some examples are in the AWS Flow Framework Recipes: https://aws.amazon.com/code/2535278400103493 https://aws.amazon.com/code/2535278400103493
To achieve this, Flow uses fancy code weaving & AOP techniques. This makes it more complicated to set up, develop, and test. Flow pays off however once your workflow is more complex than a simple linear workflow. You could, for example, process data with a distributed map/reduce pattern in a few lines of code in Flow. (Source: built production systems on SWF with and without Flow)
- AReallyGoodName 11y agoIt's unfortunate that it's the first Java example provided for anything to do with SWF. I got dumped into that from the "what is SWF" page. There's no simple Java SWF example like there is for C#. The docs dump you straight into the Flow Framework. I'd argue based on Occams Razor that a more simplistic start is what most people want. Unfortunately to get that you have to look at the documentation of another language.
- deanCommie 11y agoThe counter argument is Flow IS what you want. Why poll for decision tasks and try to schedule the work execution between different servers when SWF Flow can do it for you? All the things you found irritating are a one-time setup, and once you are chugging along you can write incredibly quickly powerful distributed systems without worrying about scaling or scheduling of any kind. But I agree the documentation could do a better job of SELLING you on that point up-front. Truth is, I don't know of any other framework or service that allows you to simply write java code like this: A = getA(); B = getB(); C = getC(A, B); D = getD(C); E = getE(B); Assuming all these getCalls are complex, time-consuming, and stateful, Flow automatically sets it up so that at the start getA() and getB() start executing in parallel (and on different servers!), getE() i immediately started once B is realized, getC() is immediately executed once both A and B are both realized, and so on. For complex workflow with undetermined execution time where the whole thing may take days to execute, the fact that you can just tweak a simple Java file to update your business logic, and add some servers to your fleet whenever you want to improve throughput is MAGICAL. Not all problems in software are simple to abstract away. I think Flow does the best it can do
- deleted 11y ago[deleted]
- mirceal 11y agoYes. It's more complicated than it needs to be, but to jump from this to "aws java doc sucks"? Most AWS doc (java or something else is pretty straightforward). Here is a minimal SWF sample I've put together a while back: https://github.com/mirceal/swf-flow-java18-sample/blob/master/README.md https://github.com/mirceal/swf-flow-java18-sample/blob/maste... Also, Flow makes things exceptionally simple once you get how it works. The SWF api is waaaay harder to use (correctly) than going through this tutorial.