Re: Typheous as a background queue

50 views
Skip to first unread message

Hans Hasselberg

unread,
Sep 13, 2012, 6:54:20 AM9/13/12
to typh...@googlegroups.com
Hi John,

I don't think there is a way to use Typhoeus as a background queue. The Hydra is something else, although you can enqueue requests and then run them. Buts its not intended as something very long running like a background job queue. 
As for the fire_and_forget, thats something I wouldn't use, because I cobsider its current implementation broken. It's also something that won't exist in the next version, although there will be something similar. 
If you're looking for doing simple and fast http requests without caring about the result, your best bet is probably ethon. Its more lowlevel than typheous. If you need help to get up and running with ethon, feel free to get back to me.

--
Hans

On Tuesday, 11. September 2012 at 22:17, John Bachir wrote:

I'd like to use Typheous to manage a background queue of requests to a remote service, where I don't need to know anything about its success. Similar to this mixpanel queue:


I was going to make my own queue with girl_friday and some http library (ethon?) buy typheous already has the queue feature built in. The problem is it wasn't designed to work as a global background queue but as a per-request parallelizer.

Is there a way to do this? the fire_and_forget method seems promising but I can't find much info on it.

Thanks,
John

--
You received this message because you are subscribed to the Google Groups "Typhoeus" group.
To view this discussion on the web visit https://groups.google.com/d/msg/typhoeus/-/QXj03ReYDW4J.
To post to this group, send email to typh...@googlegroups.com.
To unsubscribe from this group, send email to typhoeus+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/typhoeus?hl=en.

John Bachir

unread,
Oct 25, 2012, 6:13:46 PM10/25/12
to typh...@googlegroups.com
Thanks Hans for the explanation. I ended up using girl_friday. In case others encounter this thread with similar needs, here's how it works, it's very simple:

# set this up once when app is initialized
# i didn't actually use a global but have an instance of a special class, but used a global here to illustrate the idea
$queue = GirlFriday::WorkQueue.new(:your_name, size: 1) do |options|
  # url = .... compose from options
  # body = .... compose from options
  Typhoeus::Request.post(url, body: body)
end

# then around the app
# this is asynchronous and will return immediately, yay!
$queue << {foo: 1, bar: 2}

Reply all
Reply to author
Forward
0 new messages