我正在尝试使用 Simple Workflow 服务来管理 rails 应用程序的作业。我的工作基于文档中的预订示例。rake 任务如下所示:
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
其余代码在线。我正在使用 aws-flow gem(并添加了 aws-flow-core),但出现错误:uninitialized constant AWS::Flow::ActivityWorker
当我尝试运行活动工作者时。