Skip to content

Eventhos Concepts: System

jrichardsz edited this page Apr 6, 2024 · 1 revision

EVENTHOS DOCUMENTATION v0.0.0

This is only a draft version.

Eventhos is an open source system/platform that applies event based architecture principles to let an average user choreography the diverse systems, SaaS or microservice that an enterprise uses, interconnecting them.

INDEX

KEY CONCEPTS

Key concepts necessary to understand how does Eventhos's works.

EDA Event Driven Architecture

A EDA lets us have a real-time iteration with all of the systems of our enterprise. This is done by events that events that pass for a message broker (some sort of delivery middleware) and then get delivered to the subscribed services. Some of the advantages of an EDA are:

  • Hight Scalability
  • Faster data delivery.
  • Reduces the time to implement a new service.

EVENTS

All of the interesting things done by an enterprise are an event. For example the creation of a new user, the service that emits this event will be called Producer^1.

SUBSCRIBER

A subscriber is system that decides to listen a certain event^2.

EVENT BROKER

In his most basic form is middleware that makes sure that a event arrives to all of his subscribers^1.

KEY EVENTHOS CONCEPTS

Key concepts that Eventhos uses.

SYSTEM

A system that the enterprise uses.

To register a system an user should put a name, type, description and a client id of the client that was created using the /auth/client end point craeted by the oauth2-starter library. The identifier will be auto-generated.

The system can be a producer, a subscriber or both:

PRODUCER SYSTEM

A producer could be any system that the enterprise uses (Microservice, ERP, SPA, etc). He will emit an event to the eventhos system. Each producer will have a api key to access eventhos. This api key should be send in the url. A producer should also send an identifier in the same way as the api key.

SUBSCRIBER SYSTEM

The subscriber receives the events and will do something with that received event. Much like a producer it could be any system that the enterprise uses, an special subscriber will be the atlas data base.

EVENTHOS EVENT

Events need to be communicated to the rest of the systems of the enterprise, usually a simple event broker would do the event routing, in this case Eventhos is in charge to distribute all of the events. To communicate an event to the Eventhos system is necessary the use of webhooks that should be integrated in one the system of the enterprise or a in a SaaS.

A user should use the Eventhos platform to register the events in the eventhos system, the user will give the name of the event, a description, the operation type (select, new, update, delete, process) and the producer

ACTIONS

The actions are processes that will be execute in either a service or in the Atlas Data Base. Eventhos has the responsibility to "ingate" those actions and while the ingate is asynchronous Eventhos will keep track of the result using reactive programming (RXJS)^3.

A user should use the Eventhos platform to register the action in the eventhos system, the user will give the name of the event, a description, the operation type and the subscriber who will execute this action. Additionally using a postman's like interface the user will give the action the desired behavior, this will be send to the subscriber using axios configuration request https://axios-http.com/docs/req_config .

CONTRACTS

Once everything else is in place create a contract is easy. A contract describes a relationship between an event and an action.

If a contract is linked to a process event then the flow is:

WHEN IN <serviceX> THIS HAPPENS <eventX> THEN IN <serviceY> DO THIS <process-action>.

A user should use the Eventhos platform to sign a contract, indicating one of the previously mentioned flows.

Contracts can also be chained to create a deferred execution.

RECEIVING EVENTS AND EXECUTING THE CONTRACTS

Once eventhos receives an event it will try to execute all of the contract where this particular event is present. The execution of contract can either be in progress, success or failed. If it is a failure eventhos will retry a determinate amount of times, to do this the body and header of the request event will be stored in a database. All of the response information from the subscriber will also be stored.

ATLAS

Is a global data base for the whole enterprise where all of the globally relevant data will be stored. In principle this data base is agnostic (can use whatever is needed).

DIAGRAMS

GENERAL DIAGRAM

BASICDIAGRAM

SQLDIAGRAM

EVENTHOS RULES & RECOMMENDATIONS

The rules and recommendations that must be follow to guarantee the correct WorkFlow of Eventhos.

General

Events and Producers

  • Rules

    • One event should have only one service origin.
    • The api key should be send in the url.
  • Recommendations

    • One event should be only emitted one time.

Action and Subscribers

  • Rules

  • Recommendations

    • An action name should be descriptive.
    • If using oauth2 or similar security use the spec.
    • Use RESTFUL

UX DESIGN

This part is under construction. To take a look to the mockup go to: https://github.com/usil/eventhos-mockup/tree/snapshot

DATA BASE DATA DICTIONARY

Table: system

Column Data type Attributes Default Description
id INT PRIMARY, Auto increments, Not null, Unique The Id For The Producer
identifier VARCHAR(75) Not null, Unique Auto generated column, lower case name
name VARCHAR(45) Not null The name of the system
type VARCHAR(45) Not null What type of producer it is? (Microservice, ERP, CRM, CRS, etc)
client_id INT Not null The id of a client
description TINYTEXT Not null A short description for the producer
deleted Not null 0
created_at TIMESTAMP Not null CURRENT_TIMESTAMP
updated_at TIMESTAMP Not null CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP

Indices:

Name Columns Type
PRIMARY id PRIMARY
idProducer_UNIQUE id UNIQUE
indifier_UNIQUE identifier UNIQUE

Table: event

Column Data type Attributes Default Description
id INT PRIMARY, Auto increments, Not null, Unique The id for the event
system_id INT Not null foreign key to column id on table system.
identifier VARCHAR(75) Not null, Unique Auto generated column, lower case name and the operation generated by the back end
name VARCHAR(45) Not null A name for the event
operation VARCHAR(25) Not null What operation does the event represents (select, new,update, delete, process)
description TINYTEXT Not null A short description for the event
deleted Not null 0
created_at TIMESTAMP Not null CURRENT_TIMESTAMP
updated_at TIMESTAMP Not null CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP

Indices:

Name Columns Type
PRIMARY id PRIMARY
idProducer_Event_UNIQUE id UNIQUE
identifier_UNIQUE identifier UNIQUE
fk_event_system1_idx system_id INDEX

Table: action

Column Data type Attributes Default Description
id INT PRIMARY, Auto increments, Not null
system_id INT Not null foreign key to column id on table system.
identifier VARCHAR(75) Not null, Unique Auto generated column, lower case name and the operation generated by the back end
name VARCHAR(45) Not null A name for the action
http_configuration JSON Not null An http configuration that should resamblace axios config
operation VARCHAR(25) Not null What operation does the action represents (select, new,update, delete, process)
description TINYTEXT Not null A short description for the action
deleted Not null 0
created_at TIMESTAMP Not null CURRENT_TIMESTAMP
updated_at TIMESTAMP Not null CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP

Indices:

Name Columns Type
PRIMARY id PRIMARY
identifier_UNIQUE identifier UNIQUE
fk_action_system1_idx system_id INDEX

Table: action_security

Column Data type Attributes Default Description
id INT PRIMARY, Auto increments, Not null, Unique
id_action INT Not null, Unique The id of the action

foreign key to column id on table action.
type VARCHAR(45) Not null What type of security does the action has
http_configuration JSON An http configuration that should resamblace axios config for oauth2 spec.
json_path_exp VARCHAR(75) A JSON path expression for extracting the acces_key
updated_at TIMESTAMP Not null CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP

Indices:

Name Columns Type
PRIMARY id PRIMARY
idAction_Security_UNIQUE id UNIQUE
fk_Action_Security_Actions1_idx id_action INDEX
id_action_UNIQUE id_action UNIQUE

Table: contract

Column Data type Attributes Default Description
id INT PRIMARY, Auto increments, Not null, Unique
action_id INT Not null The id of the action to execute

foreign key to column id on table action.
event_id INT Not null The id of the event that the contract is listening

foreign key to column id on table event.
identifier VARCHAR(75) Not null, Unique Auto generated column, lower case name and the operation generated by the back end
name VARCHAR(45) Not null A name for the contract
active Not null 1 Is the contract currently active?
deleted 0
created_at TIMESTAMP CURRENT_TIMESTAMP
updated_at TIMESTAMP CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP

Indices:

Name Columns Type
PRIMARY id PRIMARY
id_UNIQUE id UNIQUE
fk_contract_action1_idx action_id INDEX
fk_contract_event1_idx event_id INDEX
identifier_UNIQUE identifier UNIQUE

Table: variable

Column Data type Attributes Default Description
id INT PRIMARY, Auto increments, Not null, Unique
key VARCHAR(300) Not null
name VARCHAR(45) Not null
created_at TIMESTAMP Not null CURRENT_TIMESTAMP
updated_at TIMESTAMP Not null CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP

Indices:

Name Columns Type
PRIMARY id PRIMARY
id_UNIQUE id UNIQUE

Table: recived_event

Column Data type Attributes Default Description
id INT PRIMARY, Auto increments, Not null, Unique The id for the event
event_id INT Not null The id of the event

foreign key to column id on table event.
header JSON Not null The header of the request event
body JSON The body of the request event
recived_at TIMESTAMP Not null CURRENT_TIMESTAMP When was the event recived

Indices:

Name Columns Type
PRIMARY id PRIMARY
id_UNIQUE id UNIQUE
fk_recived_event_event1_idx event_id INDEX

Table: contract_exc_detail

Column Data type Attributes Default Description
id INT PRIMARY, Auto increments, Not null, Unique The id for the event
contract_id INT Not null foreign key to column id on table contract.
recived_event_id INT Not null foreign key to column id on table recived_event.
state VARCHAR(15) Not null What satate the contract is at? (ERROR, PROCESSING, COMPLETED)

Indices:

Name Columns Type
PRIMARY id PRIMARY
id_UNIQUE id UNIQUE
fk_contract_exc_detail_recived_event1_idx recived_event_id INDEX
fk_contract_exc_detail_contract1_idx contract_id INDEX

Table: contract_exc_try

Column Data type Attributes Default Description
id INT PRIMARY, Auto increments, Not null, Unique
contract_exc_detail_id INT Not null foreign key to column id on table contract_exc_detail.
state VARCHAR(15) Not null What satate the contract is at? (ERROR, PROCESSING, COMPLETED)
header JSON Not null The header of the contact response
body JSON The response body of the contract
executed_at TIMESTAMP Not null CURRENT_TIMESTAMP When was the contract executed
finished_at TIMESTAMP When did the contract finished, either in success or with an error

Indices:

Name Columns Type
PRIMARY id PRIMARY
id_UNIQUE id UNIQUE
fk_contract_exc_try_contract_exc_detail1_idx contract_exc_detail_id INDEX

TECHNOLOGIES USED

  • Nodejs 14
  • Angular 13