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.
- Tested on Mac OS X and Ubuntu
- Currently does NOT support Windows
- Redis 2.6 or newer http://redis.io/topics/quickstart
- Ruby 2.0 or newer http://www.ruby-lang.org/en/downloads/
- It is also recommended to install RVM with a Ruby https://rvm.io/
- Fork the repo.
- Change directory to the downloaded xenograte-xct project root.
- make sure ruby gem 'bundler' is installed by using
gem list
. If it's not in the list, do agem install bundler
http://gembundler.com/ - install required ruby gems by running
bundle install
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.
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
.
Please refer to the Wiki for more in-depth knowledge on the following topics:
- Xenode: the worker process
- XenoFlow: orchestration of the worker processes
- XenoMessage: the messages flow between worker process
- Command-line Interface (CLI) Usage
We invite you to follow the development and community updates on Xenograte:
- To raise a question, an idea, or start a discussion, visit the Xenograte Community linkedin group.
- Follow @nodally on Twitter.
- Read and subscribe to the Nodally Blog.
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!