You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
response = Stalker.enqueue_with_response("sum", :a => 1, :b => 2)
or
Stalker.enqueue_with_response("sum", :a => 1, :b => 2) do |response|
puts "1 +2 = #{response['sum']}"
end
and the worker:
job_with_response "sum" do |args|
return :sum => args['a'] + args['b']
end
This would work by adding something like :respond_to => "stalker-response-#{$$}-#{SecureRandom.uuid}" to the job params, then subscribing to that queue (perhaps with a configurable timeout) where the worker will then enqueue it's return value once finished.
There could also be partial responses so one could do something like:
job_with_response "sum" do |args, response|
response['status'] = 'going to calculate!'
response['status_pct'] = 0
response['sum'] = args['a'] + args['b']
response['status'] = 'done calculating!'
response['status_pct'] = 100
end
Getting a little carried away here.
The text was updated successfully, but these errors were encountered:
I'd like to see something like :
and the worker:
This would work by adding something like :respond_to => "stalker-response-#{$$}-#{SecureRandom.uuid}" to the job params, then subscribing to that queue (perhaps with a configurable timeout) where the worker will then enqueue it's return value once finished.
There could also be partial responses so one could do something like:
Getting a little carried away here.
The text was updated successfully, but these errors were encountered: