Your SlideShare is downloading. ×
safe_bunny: Safe RabbitMQ delivery with local queueing on failure
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Saving this for later?

Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime - even offline.

Text the download link to your phone

Standard text messaging rates apply

safe_bunny: Safe RabbitMQ delivery with local queueing on failure

307
views

Published on

safe_bunny is written in erlang, and allows you to safely deliver your messages through RabbitMQ using local queues such as mysql, redis, files, and ets, and will do its best effort to publish the …

safe_bunny is written in erlang, and allows you to safely deliver your messages through RabbitMQ using local queues such as mysql, redis, files, and ets, and will do its best effort to publish the messages through rabbitmq, using confirmation in channels and retrying the delivery periodically

Published in: Software

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
307
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Safe Bunny Safe RabbitMQ delivery with local queueing
  • 2. RabbitMQ: Common Scenario Producer 1 Producer 2 Producer 3 Consumer 1 Consumer 2 Consumer 3 Routing
  • 3. Safe Bunny: What if something fails? Producer 1 Producer 2 Producer 3 No bindings for the routing key Connectivity issues Temporary issues
  • 4. Safe Bunny: Safe delivery ● Set channel in confirmation mode ● Sync operation, need to wait for server confirmation or timeout ● How/When to retry the operation? ● How to make messages survive long periods of time?
  • 5. Safe Bunny: Safe delivery Producer 1 Safe Bunny MySQL Redis File ETS Async, Fire and Forget, no delays ● In case of failure, the message is queued in one of the queue backends. ● If the queue reports an error, the next backend is tried. ● Each queue backend will periodically try to send the message. ● You choose which queues are available, and the order of preference
  • 6. Safe Bunny: delivery modes ● Direct to MQ: no local queuing: Use safe_bunny:deliver_unsafe/3. This will try to publish a message to the given exchange and routing key, and will not try to queue the message on failure. ● Direct to MQ, local queueing on failure: Use safe_bunny:deliver_safe/3. Like the above, but will queue the message in the fallback queues on failure. Fallback queues are tried in order, according to the producers option of the safe_bunny application. ● Local queuing only: Consumers will try to send the messages to the MQ. "Safest" option (because you queue first). Use safe_bunny:queue/3. One of the queue consumers should pick the new message and try to publish it via rabbitmq.
  • 7. Safe Bunny: Examples ● safe_bunny:deliver_safe(Exchange, Key, Payload) ● safe_bunny:deliver_unsafe(Exchange, Key, Payload) ● safe_bunny:queue(Exchange, Key, Payload) All arguments are binary(). Where: ● Exchange is the name of the exchange ● Key is the routing key ● Payload is anything you want it to be
  • 8. ● Concurrency tools: https://github.com/duomark/epocxy ● Worker Pool: https://github.com/tigertext/worker_pool Safe Bunny: Concurrency
  • 9. ● Jenkins, Coverage, Doc: http://ci.marcelog.name/job/safe_bunny/ ● https://github.com/marcelog/safe_bunny ● Works great with MinionPools :) https://github. com/marcelog/rabbitmq_minionpool ● RabbitMQ confirmation mode: http://www.rabbitmq.com/confirms.html ● RabbitMQ erlang client: http://www.rabbitmq.com/erlang-client-user-guide. html Safe Bunny: Useful links
  • 10. Thanks!