Project

jflow

0.01
No commit activity in last 3 years
No release in over 3 years
you know, for flow
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.10
~> 10.0
>= 0

Runtime

 Project Readme

Jflow

Build Status

JFlow is a gem that aims to let you start SWF flow activity workers for JRuby.

The official framework uses Forking and thus not compatible with the JVM. This aims to give an alternative for Jruby.

For now this only works for Activities and not workflows

Installation

Add this line to your application's Gemfile:

gem 'jflow'

And then execute:

$ bundle

Or install it yourself as:

$ gem install jflow

Usage

Create an Activity

Class FooActivity
  include JFlow::Activity::Mixin

  activity "policy_scan.run" do
    {
      domain: "alexandria-development",
      default_task_list: {
        name: "xray_activity_tasklist"
      },
      version: "1.4",
      default_task_schedule_to_start_timeout: "600",
      default_task_schedule_to_close_timeout: "600",
      default_task_start_to_close_timeout: "600",
      default_task_heartbeat_timeout: "600",
      exceptions_to_exclude: [PermanentError]
    }
  end

  def run
    "foo"
  end
end

Launch the workers

This gem provides you with a binary called jflow_worker. This binary requires a json configuration file.

jflow_worker -f worker.json

Example of a worker.json

{
  "domain": "foodomain",
  "tasklist": "footasklist",
  "number_of_workers": 100,
  "activities_path": ["/home/pate/git/foobar/lib/flow/activities"]
}

Error Handlers

You can attach your own error handler for error logging or exception handling by providing a service that responds to call(exception). If you are using Sentry, you can add Raven as error handler:

JFlow.configuration.error_handlers << Proc.new { |e| Raven.capture_exception(e) }

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/djpate/jflow.