Messaging #1236
Replies: 2 comments
-
This issue seems to attempt to do 2+ things. First, it postulates the existence of a generic problem (messaging in the context of distributed systems). Then, it tries to make it concrete for Ampersand. The '+' in '2+' refers to the reference to this issue from #1167, of which I fail to see the direct relation. I suggest we distinguish between a formal, generic approach from any kind of implementation. Artifacts resulting from our generic (conceptual) thinking might result in texts that are like this, and a file in FormalAmpersand may well be added to that (with sufficient comments/references to let readers that didn't write the text understand what's going on). Then there is the implementation. TNO's SSI-Lab already has quite some practical experiences with prototypes that use APIs for data objects that could well be classified as messages, and with writing code to handle them (both for sending and receiving). There is a banking application in TNO's SSI-Lab that allows users to to transfer money from one account to another account, provided the accounts are with the same bank. We may want to consider an experiment that would result in a demo that would allow the transfer of money between accounts of different (existing) banks. We could use the experience there to complement the conceptual thinking. |
Beta Was this translation helpful? Give feedback.
-
This sounds like a very practical idea: rebuilding the banking application in terms of streams services events and messages in &4 (Ampersand4). This allows us to experiment with the way we see things. @RieksJ do you already have a streams-and-services graph in mind for this particular application? |
Beta Was this translation helpful? Give feedback.
-
Intro
Messaging is required in the design of distributed information systems. In the past, we have had an idea of distributed systems. We called that the "Multi Context Problem". Nevertheless, distributed systems are a very practical target for Ampersand, since most information systems in practice are distributed. As a consequence, software engineers have to spend lots of effort synchronizing their messaging. In the light of cloud architecture, we see the number of services (microservices) growing in practical applications. We should target nothing short of generating multiple services including the messaging that goes with it. This issue is the first step.
Assumptions, desires, requirements.
This issue attempts to define the semantics of messages.
JSON as an example
Further down this issue, I define a conceptual model for JSON messages, trusting that it is easily implemented in other protocols too.
Here is an example message with a wee bit of code to give the flavour of digging into the message in JavaScript.
This yields the text
{"name":"city","atoms":["Amsterdam"]}
The JSON-message
can be consumed by a service that has matching relations, e.g.:
Note that the sources and targets are not complete in the JSON message, but the allocation of pairs to the relations is unambiguous and complete, so this is type-correct.
If a service cannot match one of the relations in the message, Ampersand will block with a type error. The matching process resembles type checking in the current Ampersand: source and target fields in the JSON message may be omitted if the type checker can resolve the type in the relation set of the consuming service.
Haskell
At a certain point, we'll have to tell Haskell how to compile things. This is the data structure I have in mind. (code has NOT been checked):
Each frame represents a single relation.
Frames have a tree structure. Value frames are leaves and Comp frames are nodes.
Proposal
@hanjoosten once urged me to provide FormalAmpersand code with any proposal. That is a terrific idea. I have specified the type checking and (part of) the allocation of frames to relations in the following script. It has been type-checked by Ampersand. I have not run any prototyping experiments with this script yet, so things may change.
Here is the data model:
Beta Was this translation helpful? Give feedback.
All reactions