ruby on rails - Work Off ActiveJob Queue Programatically -
with delayedjob
, it's possible instantiate worker complete jobs programatically:
delayed::worker.new.work_off # => [num_succesess, num_failures]
does activejob provide interface doing same?
currently not if planned future? don't know. activejob provide interface creating new job , perform on background in limited way.
activejob provide only:
- create new job , perform in background process
- specify name of queue have used
- ability retry job (but have specify conditions , calculate how time should wait before processed again)
- nice interface sending emails via queue
it doesn't provide:
- any nice api eg. calculate number of iteration , work in way (it planed next version probably, still quite manual https://github.com/rails/rails/blob/master/activejob/lib/active_job/core.rb#l70)
- you cannot use of hook methods in delayed_job https://github.com/collectiveidea/delayed_job#hooks
- or specify of delayed_job parameters in job https://github.com/collectiveidea/delayed_job#custom-jobs (e.g.
max_attempts
,max_run_time
, on.
it limited right now, interested gem goes , how evolve.
i hope helps bit.
Comments
Post a Comment