2. Flows
A flow defines how data is processed by the execution of one or more
actions.
Data processing involve:
₋ An execution trigger to start the data processing.
₋ Data types.
₋ Translators.
₋ Connections & Webhooks, if the data is coming in to Cenit or going out of Cenit.
3. Flow: execution triggers
Flows processing can be manually
invoked or through the occurrence
of events.
Events are of two types:
- Observers: listen for properties
changes on records.
- Schedulers: they occurs
periodically.
4. Flow: execution triggers
Flows processing can be manually
invoked or through the occurrence
of events.
Events are of two types:
- Observers: listen for properties
changes on records.
- Schedulers: they occurs
periodically.
5. Flow: execution triggers
Flows processing can be manually
invoked or through the occurrence
of events.
Events are of two types:
- Observers: listen for properties
changes on records.
- Schedulers: they occurs
periodically.
6. Flow: translator
Every flow have a translator that
performs the main data processing.
Depending on the translator type a
flow can:
- Pull (import) data into Cenit
- Export data outside Cenit
- Update/Convert data inside Cenit
A flow must define a data type
unless its translator defines one.
7. Flow: translator
Every flow have a translator that
performs the main data processing.
Depending on the translator type a
flow can:
- Pull (import) data into Cenit
- Export data outside Cenit
- Update/Convert data inside Cenit
A flow must define a data type
unless its translator defines one.
8. Flow: scope
If a flow is not of type import then it
must define a scope for data processing.
The scope can be defined depending on
the flow event, translator data type or
the flow custom data type:
- Event source process only the record
who fire the event
- All records scope process all the
records
- Filter scope process the records
following some criteria.
9. Flow: scope
If a flow is not of type import then it
must define a scope for data processing.
The scope can be defined depending on
the flow event, translator data type or
the flow custom data type:
- Event source process only the record
who fire the event
- All records scope process all the
records
- Filter scope process the records
following some criteria.
10. Flow: scope
If a flow is not of type import then it
must define a scope for data processing.
The scope can be defined depending on
the flow event, translator data type or
the flow custom data type:
- Event source process only the record
who fire the event
- All records scope process all the
records
- Filter scope process the records
following some criteria.
11. Flow: scope
If a flow is not of type import then it
must define a scope for data processing.
The scope can be defined depending on
the flow event, translator data type or
the flow custom data type:
- Event source process only the record
who fire the event
- All records scope process all the
records
- Filter scope process the records
following some criteria.
12. Flow: update/convert
When the flow translator is of type
update/convert no further configuration
is needed beyond the scope.
The active option prevent the flow
processing even if its event is fired when
it is not checked.
13. Flow: import/export
When the flow translator is of type:
- Import, then the data will be pulled
into Cenit
- Export, then the data will be send
outside Cenit
In any case an end-point is needed to
pull or send the data.
An end-point is determined by a
connection and a webhook
14. Connections
A connection consist in an URL and a set of parameters, headers and template
parameters.
The connection URL, parameters and headers can be described by using Liquid
Templates.
The template parameters and its values are available in the Liquid Templates as
local variables so URL and its components can be computed dynamically.
15. Connection example: Twilio API
The URL to connect with the Twilio API have the following form:
https://api.twilio.com/2010-04-01/Accounts/xxxxx
where xxxxx is the user account SID, and the following headers should be provided:
- Accept-Charset: utf-8
- Accept: application/json
- Authorization: Basic yyyyy
where yyyyy is the base 64 format of the user account SID and the user
Authentication Token
16. Connection example: Twilio API
https://api.twilio.com/2010-04-01/Accounts/xxxxx
- Accept-Charset: utf-8
- Accept: application/json
- Authorization: Basic yyyyy
The values of xxxxx and yyyyy can be statically typed on the URL and headers but,
they must be updated every time the user credentials change.
17. Connection example: Twilio API
A better approach is to use template parameters and Liquid Templates:
https://api.twilio.com/2010-04-01/Accounts/{{account_sid}}
- Accept-Charset: utf-8
- Accept: application/json
- Authorization: Basic {% base64 (account_sid + ':' + auth_token) %}
Defining the template parameters account_sid and auth_token Cenit computes
dynamically the connection URL and its headers.
18. Webhooks example: Twilio API
The Twilio connection is just the base URL for the actions of the Twilio API, and
these way is how occurs almost in every API.
It is possible the same URL to indicate different actions depending on the HTTP
method, for example
https://api.twilio.com/2010-04-01/Accounts/xxxxx/Messages.json
send messages using the POST method but retrieve messages when using GET.
All those actions are defined as Webhooks.
19. Webhooks example: Twilio API
So a webhook is basically a path that completes the connection URL, and HTTP
method and can define also a set of headers, parameters and template
parameters.
The webhook path of the Twilio API will be:
- Messages.json by GET list the messages.
- Messages.json by POST send a message.
- Messages/{{id}}.json by GET retrieve a message with a SID.
20. Back to Flow
Since the webhook defines the action
the flow will submit to the end-point
then the webhook is primary over
connection.
It is possible to submit the same action
to several end-points, so the
connections are not specified directly
but through a connection role.
21. Back to Flow
Since the webhook defines the action
the flow will submit to the end-point
then the webhook is primary over
connection.
It is possible to submit the same action
to several end-points, so the
connections are not specified directly
but through a connection role.
22. Connection Roles
A connection role is a relation between a set of connections and a set of webhooks
indicating that every webhook in the set can be applied to every connection also in
the set:
www.store1.com/api/v1
www.store2.com/api/2015
www.store3.com/2015
Connection Role
POST order
GET order
PUT order
23. Back to Flow, again
If the connection role is not defined then
Cenit look for any connection from
which it is possible to reach the
webhook through a connection role.
If the connection role is supplied the
Cenit only look for the associated
connections to the connection role.
24. Back to Flow, again
If the connection role is not defined then
Cenit look for any connection from
which it is possible to reach the
webhook through a connection role.
If the connection role is supplied then
Cenit only look for the associated
connections to the connection role.
25. Back to Flow, again
If the connection role is not defined then
Cenit look for any connection from
which it is possible to reach the
webhook through a connection role.
If the connection role is supplied then
Cenit only look for the associated
connections to the connection role.
26. Export Flows
If the flow translator is of type export it
is possible to process the request
response with a response translator.
Response translators are of type import
and may require a response data type if
they do not define one.
Response translators may create other
records which may fire new event that
trigger other flow processing…
27. Export Flows
If the flow translator is of type export it
is possible to process the request
response with a response translator.
Response translators are of type import
and may require a response data type if
they do not define one.
Response translators may create other
records which may fire new event that
trigger other flow processing…
28. Export Flows
If the flow translator is of type export it
is possible to process the request
response with a response translator.
Response translators are of type import
and may require a response data type if
they do not define one.
Response translators may create other
records which may fire other events that
trigger other flow processing…