Evented Applicationswith RabbitMQ , Python, and CakePHP
What the wibbleﬁsh?All about oﬄoading work, and doing things in‘realtime’Make applications that complete tasks in adistributed/scalable fashion.Doing work outside the request/response cycleof a UI/API.
Work to ofﬂoadNoti cations (SMS, Email, Postal mail).Logging.Import & export.Process image & video.Reporting.Webhooks.
Isn’t cron good enough?Cron tabs are great with one server.Cron doesn’t scale to multiple machines.Cron doesn’t solve the whole problem space.
Problems with CronIsn’t suitable for ‘real-time’ results.Requires a set schedule. You might spin upprocesses that do nothing. Or you might nothave enough capacity.Parallelizing is a pain.
Queues to the rescue!Queues accept and dispatch events.Events can contain almost anything*.Events can be roughly equal to ‘jobs’.A single event can trigger lots of downstreamwork.
Architectural beneﬁtsSeparation of concerns.Collection of mini/small applications.No monolithic applications.Decoupled, and easier to test.Easy to scale. Busy service = more of them.
ExchangesExchanges abstract queues from the producer.Route messages to queues, that are bound byrouting keys.Allows consumers to listen to speci c routingkeys.Multiple consumers can listen to the sameevents.