External process for integrations

For a number of reasons we decided to extend Viinex 2.0 with a feature of a simple but powerful way of communicating with an arbitrary third-party system.

Viinex 2.0 can send and receive events, — a structures of data with some predefined and some unspecified fields, which should also be able to serialize and deserialize into JSON format. The new way of integration with Viinex 2.0 we’re going to provide is to allow an external process to read the events coming from Viinex 2.0, and to allow that process to produce the events and send them to be processed by other objects in Viinex 2.0.

The most simple way of doing that, in our opinion, was to communicate with an external process via its standard input and output. We introduce a new Viinex 2.0 object of type “process”, which serves for starting an external process (that is, — the process is started by Viinex, and the latter manages its lifecycle). The stdin and stdout of a newly created process is connected with the instance of Viinex 2.0 it is supervised by, using pipes. Viinex uses that pipes to send the events to an external process, and to receive events from that process. The exchange is done in JSON format.

What is good about this way of interaction is that it does not require any external APIs, libraries and so on, to be used by the external process. This means the external process can be implemented in virtually any programming language; all it requires to have is an access to standard input and output, and an ability to parse and/or produce data in JSON format. Besides that, there are no requirements put by Viinex on the external process’ implementation; the latter can perform any actions and communicate any third-party subsystem it decides to.

To sum up, — the new way of integration with Viinex 2.0 is introduced, — that is, an event-based integration with an external process started and managed by Viinex instance. The former is limited in the sense that only the events interchange is specified as the expected behavior of that process, — but for the same reason it is powerful because no other assumptions are made and no limits are exposed on what other software the external process is going to interact with.

Leave a Reply