Jelajahi Sumber

Message retransmiosson UML diagram

Enzo 1 tahun lalu
induk
melakukan
3f78842cf5
6 mengubah file dengan 68 tambahan dan 46 penghapusan
  1. 1 1
      test/consumer_1.ts
  2. 0 17
      test/hero.proto
  3. 17 0
      test/message.proto
  4. 49 0
      test/mrs.plantuml
  5. 1 0
      test/obs.plantuml
  6. 0 28
      test/testGrpc.ts

+ 1 - 1
test/consumer_1.ts

@@ -80,7 +80,7 @@ function connectWebSocket() {
     socket.on('payload', (data: any[]) => {
         if(data.length > 0){
             // just to check if there's any data
-            // console.log(`Message received from publisher: ${data.length}`)
+            console.log(`Message received from publisher: ${data.length}`)
         } else {
             console.log(`Publisher is buffering. Data received = ${data.length}`)
         }

+ 0 - 17
test/hero.proto

@@ -1,17 +0,0 @@
-syntax = "proto3";
-
-package hero;
-
-service HeroService {
-  rpc FindOne (HeroById) returns (Hero);
-  rpc FindMany (stream HeroById) returns (stream Hero);
-}
-
-message HeroById {
-  int32 id = 1;
-}
-
-message Hero {
-  int32 id = 1;
-  string name = 2;
-}

+ 17 - 0
test/message.proto

@@ -0,0 +1,17 @@
+syntax="proto3";
+
+package message;
+
+service MessageService {
+    rpc HandleMessage (Request) returns (stream Response);
+}
+
+message Request { 
+    string id =1;
+    string message = 2;
+}
+
+message Response { 
+    string id = 1;
+    string message = 2;
+}

+ 49 - 0
test/mrs.plantuml

@@ -0,0 +1,49 @@
+@startuml Message Retransmission
+header Message Retransmission / Service Library
+database "Database_Pub" {
+    folder "This is log Location 1" {
+        [Messages]
+    }
+}
+database "Database_Con" {
+    folder "This is log Location 2" {
+        [Messages2]
+    }
+}
+
+component "CDMS_Pub"{
+    port MRS1
+
+}
+
+component "CDMS_Con"{
+    port MRS2
+}
+
+component "Publisher"{
+    port MRS_Pub
+    [OBS1] - MRS_Pub
+}
+
+component "Consumer"{
+    port MRS_Con
+    [OBS2] - MRS_Con
+}
+
+[Messages] <.. MRS1
+[Messages2] <.. MRS2
+CDMS_Pub <.. MRS_Pub
+CDMS_Con <.. MRS_Con
+CDMS_Pub - CDMS_Con : Synchronization over MRS library
+OBS1 - OBS2 : Basic Synchronization
+
+@enduml
+
+' Square are ports. I use them to represent the Message Retransmission Service
+' So, when Publisher creates messages from the relevant library, it will then
+' store in to it's own designated database, and will also attempt to broadcast
+' to the consumer it's relevant information. 
+' They can perform basic synhronization or utilzie the CDMC: Content Delivery Management Server
+' to manage the message payload by leveraging the MRS library to do the synching
+' MRS library will check the data loss by taking the specified data to be 
+' compared and then perform retransmission if needed.

+ 1 - 0
test/obs.plantuml

@@ -9,3 +9,4 @@ Producer --> Consumer: Next()
 Consumer --> Callback_Queue: Add to queue
 Callback_Queue --> Callback_Stack: Remove from queue \nwhen corresponding \nfunctions are called
 @enduml
+ 

+ 0 - 28
test/testGrpc.ts

@@ -1,28 +0,0 @@
-const grpc = require('grpc');
-const protoLoader = require('@grpc/proto-loader');
-
-// Load the gRPC service definition
-const packageDefinition = protoLoader.loadSync('C:/Users/esenz/dev/Task/Fis-SearchUtility/test/hero.proto');
-const protoDescriptor = grpc.loadPackageDefinition(packageDefinition);
-
-// Create a gRPC client instance
-const heroServiceClient = new protoDescriptor.hero.HeroService(
-    'http://192.168.100.32:3001/', // Replace with your server address and port
-    grpc.credentials.createInsecure()
-);
-
-// Create the gRPC request object
-const request = {
-    id: 1, // Replace with the desired hero ID
-};
-
-// Send the gRPC request
-heroServiceClient.FindOne(request, (error, response) => {
-    if (error) {
-        console.error('Error:', error);
-        return;
-    }
-
-    // Handle the response
-    console.log('Response:', response);
-});