endpoints. RTS endpoints are build on top of Web-
Socket frames with JSON formatted messages. The
use of JSON-RPC was initial proposed for these mes-
sages, unfortunately JSON-RPC is also bound to the
request/reply and fire-and-forget models. The model
we want to extend needs at least a way to send pro-
visional responses and a correct way to identify these
message types.
RTS existing models are represented in the sim-
plified sequence diagrams on Fig. 2. Here we re-
fer to clients and endpoints distinctly from network
clients and servers. These distinctions are needed be-
cause RTS endpoints are not necessarily in the net-
work servers, due to the already mentioned client-
server symmetry. Services can be installed in the net-
work clients or servers, however the connection is al-
ways established from client to server, avoiding net-
work and firewall issues. We should look at the dia-
grams independently from who is the network client
or the server.
The typical request/reply model that is used in
REST services is enlarged by the JSON-RPC fire-
and-forget model with the use of notifications. RTS
extends this with the concept of requesting streams
instead of getting all the data as a single response,
each element is streamed back in order. Streams have
a life cycle that can end with a complete or error sig-
nal from the server, a cancel signal from the client or
with a session disconnect. Stream requests are auto-
matically bound to the Pipeline flow that can be in-
tercepted and controlled by any implemented Access
Control mechanism without further coding.
Specifying communication models adds some ad-
vantages in terms of service compatibility. We can
clearly define that REST endpoints are only compat-
ible with the request/reply model, excluding any re-
quest/stream services to be linked to the REST end-
point. These definitions are not a common procedure
when describing services. We propose that, commu-
nication models should be part of any service descrip-
tion and should be included in specs like RAML
12
or
Swagger
13
. Although further studies should be car-
ried out to conclude that the models described here
can completely define all case scenarios.
3.2 Component Interactions
Looking at the architecture in Fig.1 we have identified
some Pipeline components that will be used in the se-
quence diagrams Fig. 3. This is a detailed descrip-
tion for the interaction of the request/stream model.
Two new components are presented, C-Observable
12
https://raml.org/
13
https://swagger.io/
and S-Observable, but actually can be considered
the Stub (C)lient-Observable and Skeleton (S)ervice-
Observable sides of the same component. In the Type-
script client module, the C-Observable is in truth a
ReactiveX Observable. Part of the initial flow is iden-
tical to a basic request/reply, but returning an Observ-
able flag, detected by the client framework as a mes-
sage reply with the field cmd=“obs“ instead of the
typical cmd=“ok“. The result value is an UUID for
the Observable. The client requests a response stream
in step (1) and waits for the asynchronous response
using the well know Promise pattern in step (2), sig-
naling that a background process is running. A typical
use case for this, is requesting a long task in the server
and receiving intermediate feedbacks (3) for the on-
going process, until it ends or fails (4). When the
message is delivered to the Service, it is translated to
a method invocation, as also the method return to a
translated reply message. The PipeContext life-cycle
is also extended until the stream is completed or an
error is thrown. We will not describe here all the de-
tails of all models, since the others already fall in the
common knowledge. The messages are processed by
the following Pipeline components:
• PipeResource is an abstraction for any connec-
tion or session (using TCP or any other protocol).
Is also a placeholder for the connection resources,
hence the chosen name. Any resources or sub-
scriptions are state-full until the connection is re-
leased.
• PipeContext is an abstraction for a request con-
text. In a REST endpoint this has the same life-
cycle of a PipeResource, but in RTS with keep
alive WebSockets, PipeResource’s can live much
longer than any PipeContext. The context is
available to services via Dependency Injection to
the method parameters, e.g providing the context
User to the service.
• Service is a user class extension of an available
interface IComponent (more on this later). Ser-
vices expose methods as public endpoints and de-
pending on the declared returned value it maps to
a defined communication model.
3.3 Service Meta-Data and Descriptors
Service Descriptors are useful for integrations, ser-
vice discover and Proxy Stub generators, effec-
tively removing the guesswork in calling the ser-
vice. In RTS, descriptors are decoupled from the
service meta-data similar to how service endpoints
are from the definitions. The meta-data is gener-
ated from Xtend Active Annotations and from ser-
CLOSER 2018 - 8th International Conference on Cloud Computing and Services Science
334