#rabbitmq IRC Log

Index

IRC Log for 2011-08-18

Timestamps are in GMT/BST.

[8:04] <shekispeaks> why does not rabbit mq maintain its older version in the apt repo.
[8:04] <shekispeaks> http://www.rabbitmq.com/debian/pool/main/r/rabbitmq-server/
[8:30] <bob235> see http://www.rabbitmq.com/releases/rabbitmq-server/
[15:12] <cavneb> hey all.. what would be considered best practice for adding jobs to the queue using amqp? Should I start and stop an event machine every time I add an item? It seems a bit confusing
[15:12] <antares_> cavneb: no
[15:12] <antares_> cavneb: eventmachine is started once, connection is open once
[15:12] <antares_> often 1 channel is enough
[15:13] <antares_> cavneb: please read http://bit.ly/amqp-model-explained and then the rest of http://bit.ly/amqp-gem-docs
[15:13] <cavneb> i've gone over those several times.. I think maybe I am not smart enough to fully comprehend it.. I'll do it again though
[15:13] <antares_> imagine that HTTP uses persistent connections all the time
[15:13] <cavneb> I guess I don't understand how to access the AMQP from outside the amqp reactor
[15:14] <antares_> would you tear it down and open it again every time? probably not
[15:14] <antares_> how to access what?
[15:14] <cavneb> it seems that the only way to add to the queue is by doing it within the AMQP reactor...
[15:15] <antares_> EventMachine reactor in most apps is started in a separate thread and then you just do what you need
[15:15] <antares_> ok
[15:15] <antares_> first of all, there is no such thing as "AMQP reactor"
[15:15] <cavneb> lol.. see? i'm slow :D
[15:15] <antares_> it is EventMachine reactor, also known as "event loop"
[15:15] <antares_> yes, network activity only happens when EventMachine even loop is running
[15:16] <nDuff> well, "event loop" is the more generic term
[15:16] <antares_> two ways to start EM event loop are EventMachine.run and AMQP.start
[15:16] <antares_> AMQP.start is a shorthand for EventMachine.run { AMQP.connect(…) }
[15:16] <cavneb> which is why I referred to it as the reactor
[15:17] <cavneb> (I understand that the reactor is EM)
[15:17] <antares_> https://github.com/michaelklishin/rubyonrails23_unicorn_amqp_gem_example/blob/master/config/unicorn/development.rb#L20
[15:18] <antares_> not the best example but it demonstrates that you start EM event loop (in a thread, because Unicorn needs to use main Ruby thread to work), then use AMQP entities as demonstrated in doc guides
[15:19] <cavneb> so you call EM.next_tick inject into the EM to publish
[15:19] <antares_> if you use AMQP.start, it will set up two things for you: AMQP.connection (just 1 connection, you can open 10 more if necessary) and AMQP.channel (just 1 channel, you can have tens of thousands)
[15:19] <cavneb> I think that was my misunderstanding
[15:19] <antares_> cavneb: EventMachine.next_tick is a way to run some piece of code when EM is actually running
[15:19] <cavneb> right
[15:19] <antares_> EM needs time to start (it may be milliseconds but still)
[15:20] <antares_> this example simply publishes code when Unicorn boots
[15:20] <cavneb> ok.. here's my setup..
[15:20] <cavneb> I have a AMPQ loop running and listening
[15:20] <antares_> your classes in lib can use AMQP.channel and that's it
[15:20] <cavneb> ah
[15:21] <antares_> or well, any code can
[15:21] <antares_> AMQP.start will open one channel for you
[15:21] <antares_> you can open it yourself: AMQP.channel = AMQP::Channel.new(AMQP.connection)
[15:21] <antares_> that's it
[15:21] <antares_> it is just an accessor
[15:21] <cavneb> I think I was overcomplicating it
[15:21] <antares_> for apps that only need 1 connection and possibly 1 channel
[15:22] <antares_> we do need a better example but before 0.8.0 release and another round of documentation improvements that is unlikely to happen
[15:22] <cavneb> I am taking lots of notes and posting them on a github repo (https://github.com/cavneb/learning)
[15:22] <cavneb> I have a non-committed section on AMQP
[15:22] <cavneb> that I am trying to get examples working
[15:22] <cavneb> once I have that, i'll post it to you
[15:23] <cavneb> ie. AMQP for Dummies (like me)
[15:23] <antares_> cavneb: travis-ci.org worker is another example (although we are far from fully migrating to AMQP because we have some specific needs that require RabbitMQ extensions), take a look: https://github.com/travis-ci/travis-worker/blob/master/lib/travis/worker/application.rb#L17
[15:23] <antares_> cavneb: that example is a consumer app (it mostly handles messages), while most Web apps are just producers (only publish messages)
[15:24] <antares_> cavneb: it would be better if you post a gist and let me take a look :)
[15:24] <antares_> although I appreciate any kind of feedback
[15:24] <cavneb> sounds good.. i'll do that
[15:24] <cavneb> I appreciate how patient you are :D
[15:25] <antares_> cavneb: finally, if you still cannot understand how to integrate event loop into your app, there is a good sync (blocking) client
[15:26] <cavneb> antares_ I am determined to wrap my head around this. I think I am just making assumptions that are incorrect
[15:26] <antares_> that is well maintained and also widely used. it has no documentation guides and lacks a lot of features (also, supports no RabbitMQ extensions) but it may be sufficient
[15:26] <antares_> it is dead easy to use
[15:26] <cavneb> bunny?
[15:26] <antares_> correct
[15:26] <antares_> and even though I maintain amqp, I try to help bunny maintainers every way I can. I even did a couple of point releases :)
[15:27] <cavneb> i already have done that.. that was easy to do. I prefer EM over rake scripts though due to the benefits EM provides.. not sure if I'm right, but it seems correct
[15:28] <antares_> cavneb: EM is a great library but a lot of applications do not really need it :) but once you get event loop and evented architectures, you can use evented libraries in any language
[15:29] <antares_> if you only publish 1-50 messages per second and do not need more sophisticated AMQP features, you can get very far without EventMachine
[15:29] <antares_> amqp gem is great for consumer apps, they are inherently event-driven
[15:29] <antares_> publishers are often not
[15:31] <cavneb> antares_ interesting. l think with your advice I will stick to the easier path and use bunny
[15:31] <antares_> cavneb: cool. amqp gem docs are always there to explain you the concepts
[15:31] <antares_> bunny supports all commonly used operations
[15:31] <antares_> or almost all
[15:32] <cavneb> do you know of any good examples of rake tasks that perform the consumption of queues via bunny?
[15:33] <cavneb> here is my rake currently:
[15:33] <cavneb> https://gist.github.com/1154172
[15:34] <cavneb> https://gist.github.com/1154177
[15:37] <antares_> wait
[15:37] <antares_> so you need a consumer?
[15:37] <antares_> then amqp gem will probably be easier :)
[15:38] <antares_> we actually have plenty of code examples: https://github.com/ruby-amqp/amqp/tree/master/examples
[15:38] <antares_> cavneb: can you explain how you want the rake task to work?
[15:40] <antares_> cavneb: your code looks good but drop_queue probably doesn't really delete anything
[15:40] <antares_> you need to use Queue#delete to actually delete it on the server
[15:40] <cavneb> drop_queue is for testing uses only
[15:40] <antares_> ah, I see
[15:40] <cavneb> for automated testing :D
[15:40] <antares_> well, if you have most of the work done already, just use it
[15:40] <cavneb> i want to basically call x number of runners to listen
[15:40] <antares_> no need to switch
[15:40] <cavneb> ya
[15:41] <cavneb> i have a bad habit of wanting to more than I need sometimes :D
[15:41] <cavneb> lol
[15:41] <antares_> amqp gem is fully tested using an RSpec extension called evented-spec :)
[15:41] <cavneb> ya.. i was looking at that
[15:41] <antares_> so testing of evented code is perfectly possible and easy
[15:41] <cavneb> we have a dedicated rabbitmq server for testing
[15:41] <cavneb> and our tests append the users name on the queue name
[15:42] <cavneb> I think that will be sufficient for our needs on this
[15:43] <cavneb_> disconnected
[15:43] <cavneb_> weird
[15:43] <cavneb_> anyway, thanks antares_ for all your help!
[15:48] <cavneb> not sure if you got my thanks antares_ but thanks :D my connection keeps going up and down
[15:51] <antares_> cavneb: I did. No problem, ask if you have more questions.
[15:51] <cavneb> thx :D
[22:53] <kyleburton> hello
[22:53] <kyleburton> we had a rabbit crash (2.5.0) and I'm wondering if we should report it somewhere
[22:54] <kyleburton> ...then how...
[22:55] <kyleburton> if I'm interpreting the log file correctly it was rewriting the persister file when it crashed, when we restarted rabbit it discarded the contents as far as I could tell

These logs were automatically created by MyxoRoboto on irc.freenode.net using the Java IRC LogBot.