-
Notifications
You must be signed in to change notification settings - Fork 3
Usage
Felix Bole edited this page Mar 20, 2025
·
1 revision
Deploy a chain using NodeSupervisor.
const chainConfig = [
{ services: [], location: 'local', monitoringHost: 'http://localhost:8887/' },
{ services: ['http://localhost:8888/service1'], location: 'remote' }
];
const data = { hello: 'here the data' };
const supervisor = NodeSupervisor.retrieveService();
const chainId = await supervisor.handleRequest({
signal: 'chain_deploy',
config: chainConfig,
data
});Start a deployed chain using its chainId.
await supervisor.handleRequest({
signal: 'chain_start',
id: chainId,
data
});Control nodes with signals like suspend or resume.
-
Suspend a Node:
{ "hostURI": "http://localhost:8888/", "chainId": "your-chain-id", "targetId": "http://localhost:8888/service1" }Send to
POST /node/suspendon the connector. -
Resume a Node: Use
POST /node/resumewith a similar payload.
The LiteConnector is a test tool for the library.
-
Start the Server:
const connector = new LiteConnector(8887, 'connector1'); await connector.startServer();
-
Create and Start a Chain: Use
POST /chain/create-and-start:{ "chainConfig": [ { "services": [], "location": "local", "monitoringHost": "http://localhost:8887/" }, { "services": ["http://localhost:8888/service1"], "location": "remote" } ], "data": { "hello": "here the data" } } -
Endpoints:
-
/node/resume: Resume a node. -
/node/suspend: Suspend a node. -
/node/communicate/:type: Handle setup, run, or notify actions.
-
node ./launch-connectors.js
Endpoint: POST http://localhost:8887/chain/create-and-start
This endpoint allows you to configure and start a chain in a single request.
Example 1: With metadata, resolver, and configuration
{
"chainConfig": [
{
"services": [],
"location": "local",
"monitoringHost": "http://localhost:8887/"
},
{
"services": [{"targetId": "service1", "meta":{"resolver": "http://localhost:8888/", "configuration":{"a": "some configuration"}}}],
"location": "remote"
}
],
"data": {
"hello": "here the data"
}
}node ./launch-connectors.js --type 1
POST: http://localhost:8887/chain/create-and-start
*Payload Example parallel, with meta data, resolver and configuration:
{
"chainConfig": [
{
"services": [],
"location": "local",
"monitoringHost": "http://localhost:8887/",
"childMode": "parallel", // possible values "normal", "parallel", "undefined"
"chainConfig": [
{
"services": [{"targetId": "service_0_0"}],
"location": "local",
"monitoringHost": "http://localhost:8888/"
}
]
},
{
"chainConfig": [
{
"services": [{
"targetId": "service_1_0",
"meta": {
"configuration": {
"a": "some configuration"
}
}
}],
"location": "local",
"childMode": "normal", // "normal" same as if it was "undefined"
"monitoringHost": "http://localhost:8889/"
}
],
"location": "remote"
}
],
"data": {
"hello": "here the input data"
}
}