[英]Pass job results to other job with Sidekiq
我进行API调用以获取电子邮件地址。 成功后,我想将此电子邮件地址传递给另一份工作。 我使用sidekiq和sidekiq批量宝石。
class HandleWebhookJob
def perform
batch = Sidekiq::Batch.new
batch.description = "Handling webhook"
batch.on(:success, HandleWebhookJob::OtherJob, { email: @email })
batch.jobs do
@email = GetEmailJob.perform_async # returns email address
end
end
class OtherJob
def on_success(status, options)
puts options # no email address here - nil
# need to pass it to UseEmailJob.perfom_async(options[:email])
end
end
end
我假设将GetEmailJob的结果分配给@email无效。 找不到如何执行此操作的示例,甚至可能的话。
我认为你jid
在@email
。 您是否可以使用prefix:jid
键将GetEmailJob
电子邮件保存到某个存储区(例如redis),然后从那里取出它们?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.