Richard Bucker

Flow Based Programming in Go

Posted at — Aug 26, 2014

Go is not the ideal language for implementing a Flow Based Programming environment but it works.One challenge was that the network graph of nodes started off as statically compiled and linked during the POC stage. ┬áLater I was able to leverage the init() function in order to link the types in what I called the registration process. In the package’s init function I would create an instance of a wrapper type that would make it easy to decode the JSON config. This meant that when the dynamic network was applied and the mini-microservices were started that the messages would flow as expected.I have not gotten to the point where I know how multiple instances of a particular node is handled… in sort of a fan-out model. But I’m sure it’s in the book.one other challenge is that while the goroutines and channels are well suited… they are limited to the current process. The networked version of the channel (netchan) has been deprecated and no suitable replacement has been named although the docker team has made a recommendation which is currently incomplete. There are a few others out there… but for docker to succeed this needs to be implemented.PS: this model is working in my flowstaller project. In this project I have a DSL that looks a lot like the nodes in the FBP model without the concurrency. In the flowstaller I have a wrapper type, the wrapped type, the init() function and the worker called do().