Theosis / xenograte-xct

Xenograte Community Toolkit (XCT)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Xenograte Community Toolkit (XCT)

Xenograte is a platform that allows you to manage and orchestrate worker processes, and easily design the flow of data shared among them, on one server or across multiple servers.

Xenograte Community Toolkit (XCT) provides you with a Command-line Interface and other required resources to build, test, and debug those worker processes, in Ruby, on a single machine. You can then weave these worker processes together into powerful integrations and automations.

Environment

  • Tested on Mac OS X and Ubuntu
  • Currently does NOT support Windows

Prerequisites

To Install:

  1. Fork the repo.
  2. Change directory to the downloaded xenograte-xct project root.
  3. make sure ruby gem 'bundler' is installed by using gem list. If it's not in the list, do a gem install bundler http://gembundler.com/
  4. install required ruby gems by running bundle install

Quick Start

in Xenograte, we call a worker process a Xenode

There are basically three types of worker processes (Xenodes). The first produces data and does not read messages (producer). The second that will read and write messages (producer/consumer), and the third that just reads messages (consumer). Any xenode can be one of these three types. It just depends on what methods you implement in your Xenode.

A simple producer/consumer Xenode can look like the following:

class EchoNode
  include XenoCore::NodeBase
  def process_message(msg)
    write_to_children(msg)
  end
end

The above is an echo Xenode. All it does is write the received message to its children.

class HelloWorldNode
  include XenoCore::NodeBase
  def process()
    msg = XenoCore::Message.new
    msg.data = "hello world"
    write_to_children(msg)
  end
end

The above is a "Hello World" Xenode as a producer example. It will write a message to its children every 1.5 seconds when the loop_delay value is set to 1.5. The message will have the value of "hello world" in its data.

class DataWriterNode
  include XenoCore::NodeBase
  def process_message(msg)
    File.open(msg.context[:filename], 'w') do |f|
      f.write(msg.data)
    end
  end
end

The above is a data writer Xenode. It looks at the inbound message's context for file_name to which to write the data. As a consumer it does not write messages to any children as it is a terminus node.

in Xenograte, we call an orchestration of the worker processes a XenoFlow

A XenoFlow is just a YAML file that defined the way a message flows between Xenodes.

In this XenoFlow, Xenode n1 has one child n2, and n2 has no child.

---
xflow1:
  id: xflow1
  xenodes:
    n1:
      id: n1
      klass: EchoNode
      path: echo_node
      children:
      - n2
    n2:
      id: n2
      klass: EchoNode
      path: echo_node
      children: []

When you run the above XenoFlow, whenever n1 receives a message, n1 will send the message to n2.

Digging Deeper

Please refer to the Wiki for more in-depth knowledge on the following topics:

  1. Xenode: the worker process
  2. XenoFlow: orchestration of the worker processes
  3. XenoMessage: the messages flow between worker process
  4. Command-line Interface (CLI) Usage

Community

We invite you to follow the development and community updates on Xenograte:

Contributing

The Xenograte Community Toolkit is open source and we encourage you to contribute! The community is yours to grow so if you have built cool new Xenodes or XenoFlows, have suggestions for improvements, or if you found a bug that needs to be fixed, feel free to fork the projects and do a pull request. Please review the contributing guidelines for details.

The Xenograte community belongs to its users and it will be built from the bottom up, so every bit of your contribution will help to grow this community, be it sharing Xenodes, submitting a bug, providing feedback, discussing problems to solve, etc. We are certain that everything you do will benefit everyone in the community down the road!

About

Xenograte Community Toolkit (XCT)

License:Other