Project

ruote-nats

0.0
No commit activity in last 3 years
No release in over 3 years
NATS participant and receivers for ruote
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

Runtime

>= 0.4.6
>= 0.4.22
= 2.2.0
 Project Readme

ruote-nats

ruote-nats is an implementation of the ruote participant and receivers to process workitem on remote host using NATS.

System Diagram

Usage

Participant registration:

engine.register_participant :remote_shell, RuoteNATS::Participant

Process definition:

remote_shell :command => '/bin/date', :env => { 'LANG' => 'C' }

Options

  • queue: subject to publish command name, the default value is "remote.command".
  • executor: executor to dispatch on remote host, the default value is "RuoteNATS::ShellExecutor".

Options for ShellExecutor

  • command: (required) shell script.
  • env: environments variables for command.

Single File Example

require 'bundler/setup'

require 'ruote'
require 'ruote-nats'

RuoteNATS.logger.level = Logger::DEBUG

NATS.start do
  begin
    pdef = Ruote.define do
      remote_shell :command => '/bin/date', :env => { 'LANG' => 'C' }
    end

    engine = Ruote::Engine.new(Ruote::Worker.new(Ruote::HashStorage.new))
    engine.register_participant :remote_shell, RuoteNATS::Participant

    RuoteNATS::CommandReceiver.new.start
    RuoteNATS::ReplyReceiver.new(engine).start

    engine.launch(pdef)

    EM.add_timer(1) do
      NATS.stop
    end
  rescue
    Logger.new(STDOUT).error($!.message)
  end
end