2

I am attempting to use the Simple Workflow service to manage jobs for a rails application. I am basing my work off the booking example from the documentation. The rake task looks like:

require "#{Rails.root}/app/helpers/application_helper"
include ApplicationHelper

namespace :swf do
  desc 'Start activity worker'
  task :activity => :environment do
    swf, domain = swf_domain
    activity_worker = AWS::Flow::ActivityWorker.new(swf.client, domain, SWF_ACTIVITY_TASK_LIST, ScrapeActivity) { {:use_forking => false} }
    activity_worker.start
  end

  desc 'Start workflow worker'
  task :workflow => :environment do
    swf, domain = swf_domain
    worker = AWS::Flow::WorkflowWorker.new(swf.client, domain, SWF_WORKFLOW_TASK_LIST, ScrapeWorkflow)
    worker.start
  end

  desc 'Queue activities'
  task :scrape => :environment do
    swf, domain = swf_domain
    my_workflow_client = workflow_client(swf.client, domain) { {:from_class => "ScrapeWorkflow"} }

    Product.all.each do |product|
      $workflow_execution = my_workflow_client.start_execution(product.asin)
    end
  end
end

The rest of the code is online. I'm using the aws-flow gem (and I added aws-flow-core), but I'm getting an error: uninitialized constant AWS::Flow::ActivityWorker when I try to run the activity worker.

dysbulic
  • 3,005
  • 2
  • 28
  • 48

1 Answers1

0

I fixed this issue by adding to the rake task:

require "#{ENV['GEM_HOME']}/gems/aws-flow-1.0.0/lib/aws/decider.rb"
dysbulic
  • 3,005
  • 2
  • 28
  • 48