OpenFlow와 OpenRPA는 Server Client 구조로 되어있음
websocket 및 http 프로토콜 사용 , 데이터 적재를 위해 Mongodb를 사용
여러 서버에 Job을 나눠주기 위해 Rabbit MQ를 통한 Job Queue를 구현
- Job Queue는 userid(실제 userid가 아니라 user key 값)로 queue이름이 정해져 있고 user별로 job이 분배되어 실행
-> 타 유저의 경우 다른 queue를 가지게 됨
- OpenFlow -> Rabbit MQ를 이용해 RPA Agent들에 일을 시키는 역할
- typescript 기반으로 제작 되었음
- Controller.ts 에서 OpenFlow 대부분의 역할 제어
- Controller.ts → OpenFlow page 내에 동작하는 이벤트들의 대부분을 제어함
- Websocket, Dbconnection ts에서 DB연결 및websocket 및 http 프로토콜 사용을 위한 connection 역할
- Report.html → workflow execute count / on,off chart 제공
ReportsController 참조
export class ReportsCtrl extends entitiesCtrl<Base>
{
public message: string = "";
public charts: chartset[] = [];
public datatimeframe: Date;
public onlinetimeframe: Date;
public timeframedesc: string = "";
async workflowclick(points, evt): Promise<void> {
async robotclick(points, evt): Promise<void> {
해당 코드 참조하여 차트 생성하여 view
Node-RED
Node-RED 는 모든 도구 ( OpenRPA 및 OpenFlow )는 물론 하드웨어 장치, API 및 온라인 서비스까지 새롭고 흥미로운 방식으로 연결하는 데 사용되는 프로그래밍 도구
Node-RED 와 OON 스택 간의 통신은 MQTT 프로토콜 (RabbitMQ 기반)을 통해 수행
MQTT (Message Queuing Telemetry Transport)
낮은 대역폭, 높은 지연 시간 또는 신뢰할 수없는 네트워크로 제한된 장치를 위해 설계된 매우 간단하고 가벼운 메시징 프로토콜
NPM을 사용하여 OpenFlow Node-RED 실행
npm i openflow-nodered -g >> windows
sudo npm i openflow-nodered -g >> Linux
openflow-nodered-cli --init
rabbitMQ 에서 전달된 message queue 제어 class
export class QueueCtrl extends entityCtrl<Base>
async processdata() // 전달된 queue 처리 메서드
async DeleteQueue(model) // queue 삭제 메서드
Message.ts → 소켓 통신을 통해 rabbitMQ 에서 전달 받아서 Controller.ts에 전달하기 위한 동작들을 수행(?)
Mutex.ts // websocketServerClient.ts
→ Semaphore , Mutex, Critical section 관련 내용 기재
Mutex.ts
export class Mutex {
private mutex = Promise.resolve();
lock(): PromiseLike<() => void> {
let begin: (unlock: () => void) => void = unlock => { };
this.mutex = this.mutex.then(() => {
return new Promise(begin);
});
return new Promise(res => {
begin = res;
});
}
async dispatch<T>(fn: (() => T) | (() => PromiseLike<T>)): Promise<T> {
const unlock = await this.lock();
try {
return await Promise.resolve(fn());
} finally {
unlock();
}
}
}
→ Mutex
Critical Section을 가진 쓰레드들의 Runnig Time이 서로 겹치지 않게 각각 단독으로 실행되게 하는 기술 다중 프로세스들의 공유 리소스에 대한 접근을 조율하기 위해 locking과 unlocking을 사용
즉, 쉽게 말하면 뮤텍스 객체를 두 쓰레드가 동시에 사용할 수 없다는 의미
→ Semaphore
공유된 자원의 데이터를 여러 프로세스가 접근하는 것을 막는 것