This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| node worker.js |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const XYZ = require('xyz-core') | |
| let ms = new XYZ({ | |
| selfConf: { | |
| name: 'client.ms', | |
| transport: [{type: 'HTTP', port: 5000}], | |
| host: '127.0.0.1' | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const XYZ = require('xyz-core') | |
| const fs = require('fs') | |
| // create a new microservice | |
| let worker = new XYZ({ | |
| selfConf: { | |
| name: 'worker.ms', | |
| // rename this if you want to deploy on a VPS | |
| host: '127.0.0.1', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ node client.js |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // worker.js log | |
| [2017-4-2 16:33:6][[email protected]:6000] info :: JOIN PING ACCEPTED. response : {"services":{"":{}},"nodes":["127.0.0.1:5000"],"transportServers":{"5000":["CALL","PING"]}} | |
| [2017-4-2 16:33:6][[email protected]:6000] info :: A new node {127.0.0.1:5000} added to systemConf | |
| [2017-4-2 16:33:6][[email protected]:6000] info :: SR :: System Configuration changed new values: {"nodes":["127.0.0.1:6000","127.0.0.1:5000"]} | |
| // client.js log | |
| [2017-4-2 16:33:6][[email protected]:5000] info :: A new node {127.0.0.1:6000} added to systemConf | |
| [2017-4-2 16:33:6][[email protected]:5000] info :: SR :: System Configuration changed new values: {"nodes":["127.0.0.1:5000","127.0.0.1:6000"]} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // client.js log | |
| task/io response: null written | |
| task/cpu response: null 9.33262154439441e+155 | |
| task/cpu response: null 9.33262154439441e+155 | |
| task/cpu response: null 9.33262154439441e+155 | |
| task/cpu response: null 9.33262154439441e+155 | |
| task/cpu response: null 9.33262154439441e+155 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const express = require('express') | |
| const XYZ = require('xyz-core') | |
| const app = express() | |
| const EXPRES_PORT = 4001 | |
| // setup xyz | |
| const front = new XYZ({ | |
| selfConf: { | |
| name: 'front.ms', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| HTTP/1.1 200 OK | |
| X-Powered-By: Express | |
| Content-Type: application/json; charset=utf-8 | |
| Content-Length: 31 | |
| ETag: W/"1f-5BgiCd8igfyPhK/4unDH1iI+hM0" | |
| Date: Sun, 02 Apr 2017 12:38:17 GMT | |
| Connection: keep-alive | |
| {"err":"Not Found","body":null}% |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ curl -X POST -i "http://localhost:4001/service?service_path=task/io" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| front.js log | |
| [2017-4-2 17:8:17][[email protected]:4000] warn :: Sending a message to /task/io from first find strategy failed (Local Response) |
OlderNewer