@foci-solutions/orbital-cli
This project is a utility to assist with the deployment and implementation of the Orbital Bus constructed by Foci Solutions. Using this project, you can generate template files and ultimately actual code libraries necessary for the deployment of an Orbita
Last updated 6 months ago by luoyi .
BSD 3-Clause License · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @foci-solutions/orbital-cli 
SYNC missed versions from official npm registry.

Orbital CLI Project

This project is a utility to assist with the deployment and implementation of the Orbital Bus constructed by Foci Solutions. Using this project, you can generate template files and ultimately actual code libraries necessary for the deployment of an Orbital agent module.

How to create a service

Create a Service

Open a terminal where you want to create your service.

orbital create:service ServiceName

This will create a directory with the name provided, ServiceName, and a .orbital file that will look like.

{
    "serviceName": "ServiceName",
    "consul": {
        "address": "localhost",
        "port": 8500
    },
    "rabbit": {
        "address": "localhost",
        "port": 5672,
        "username": "guest",
        "password": "guest"
    }
}

If the addresses and/or ports for Consul or RabbitMQ are different from the above, change them.

Create an Operation

Now is the time to create an operation. For the purpose of this example we will create just one operation.

Go to the ServiceName folder and run the following command

orbital create:operation OperationName -a Adapter.Rest -s

It will create the following folder structure


ServiceName
    |___ OperationName
    |          |__adapterConfigurations
    |                     |__adapterConfig.json
    |          |__schemas
    |                |__request.json
    |                |__response.json
    |          |__translations
    |                |__translation.js
    |___.orbital

Inside the OperationName folder, we will modify the following:

  • adapterConfigurations
  • schemas
  • translations

Starting with adapterConfigurations, you will open adapterConfig.json and should look like this:

{
    "type": "Adapters.Rest",
    "configuration": 
    {
        "uri": "",
        "method": "GET",
        "headers": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
          ]
    }

}

Here you will write in the uri section to indicate the endpoint you want to reach and add or modify other sections to comply with the requisits the endpoint asks to be able to get a response back.

For schemas, the request.json or response.json schema should look like this:

{
    "title": "",
    "description": "",
    "type": "object",
    "typeName": "",
    "properties": {
        "id": {
            "type": "string"
        }
    }
}

You will accomodate the schemas to the properties you need to receive or send.

Finally our translations looks like:

[!code-javascriptGetUserTranslation]

You should not modify the name of these functions at all. You can do all the javascript code inside these 3 functions to manipulate the data you send or receive.

Build the Service

Still inside the ServiceName folder, you will write the following command:

orbital build

This command will create a bin folder with a ServiceDefinition.json file. This file will be used by the Agent to know about the services you create.

Publish the Service

Finally you will run the following command to publish your new service to Consul and RabbitMQ:

orbital publish

you can check out Consul to verify that your ServiceName service and orbital.ServiceName.definition K/V are there.

Licensing Information

Orbital CLI is licensed under the 3-Clause BSD license for open-source software. Please see the LICENSE file for more information.

Contact Information

For inquiries about the project, please e-mail us at opensource@focisolutions.com.

Current Tags

  • 4.0.451-beta                                ...           beta (6 months ago)
  • 4.1.462                                ...           latest (6 months ago)

23 Versions

  • 4.1.462                                ...           6 months ago
  • 4.1.459                                ...           6 months ago
  • 4.1.456                                ...           6 months ago
  • 4.1.453                                ...           6 months ago
  • 4.0.451-beta                                ...           6 months ago
  • 4.0.435                                ...           7 months ago
  • 4.0.433                                ...           7 months ago
  • 4.0.432-beta                                ...           7 months ago
  • 4.0.430-beta                                ...           7 months ago
  • 4.0.429-beta                                ...           7 months ago
  • 4.0.427-beta                                ...           7 months ago
  • 3.0.12                                ...           8 months ago
  • 3.0.11                                ...           8 months ago
  • 3.0.9                                ...           8 months ago
  • 3.0.8                                ...           8 months ago
  • 3.0.7                                ...           9 months ago
  • 3.0.6                                ...           9 months ago
  • 3.0.5                                ...           9 months ago
  • 3.0.4                                ...           9 months ago
  • 3.0.3                                ...           9 months ago
  • 3.0.2                                ...           9 months ago
  • 3.0.1                                ...           9 months ago
  • 3.0.0                                ...           9 months ago
Downloads
Today 0
This Week 0
This Month 46
Last Day 0
Last Week 46
Last Month 47
Dependencies (16)
Dev Dependencies (14)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |