I have a small problem with the rabbit that I do not understand. I am using:
- Ruby version 1.8.7
- AMQP GEM version 0.7.0
- RabbitMQ v2.3.1
- Ruby-smpp v0.4.0
My code looks like this:
Loop AMQP Start Event MacKina :: Run @@ tx = EventMachine:: Connect (Config [: Host], Config [: Port], SMPP :: Transceiver, Config, Self # Representative, Callback on MO and DRS and other events EM.add_timer (10) does "AMQP New" amq = MQ.new amq.queue ("# {provider}"). Subscribe (: ack => true). Header, msg | "Provider # {Provider} Customer # Process {# Process.pid} Processed # {msg}" header.ack End End EM.add_timer (30) {EventMachine :: stop_event_loop} End and AMQP.stop "# {config [ : Host]} disconnected .. reconnecting in 35 seconds. "Sleep 35 End
I added this line for testing EM.add_timer (30) {event McKine :: Stop_Avent_Loop}
So after 30 seconds I stop the event loop, it sleeps for 35 seconds and restarts everything. The problem is that amq = MQ.new seems to do something and it does not give me any errors, but membership does not seem to be working. Apart from this there is no error but only after the process has stopped and restarting it again subscribes it and processes the messages. I do not understand why
AMQP.start does it with its EM magic - it may be that What is cutting?
How to AMQP inside the EM run (or it seems)
Comments
Post a Comment