Skip to content

Instantly share code, notes, and snippets.

@okitan
Created November 4, 2011 22:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save okitan/1340682 to your computer and use it in GitHub Desktop.
Save okitan/1340682 to your computer and use it in GitHub Desktop.
amqp 対策メモ

方針

ErrorHandlingによると, amqp ~> 0.8.0 ならば AMQP::Channel#auto_recovery で再接続が可能

別環境でも障碍の再現がうまくいかなかった場合は,クライアントサイドで対応するしかない

従って,アップグレードするため amqp ~> 0.8.0 にしたいが,現行の amgp = 0.7.1 からのアップグレードに何が必要か考える

amqp ~> 0.8.0

参考: https://github.com/ruby-amqp/amqp/blob/master/docs/08Migration.textile

全般

AMQP::Channel#auto_recovery で切断時に再接続すること

enqueue する人

AMQP::Queue#publishは deprecated になっている とはいえ代わりに何を使えと書いてないんだがw

おそらく exchange を直接使うと思うのだけど,1:1 のメッセージングだから AMQP::Exchange#direct を使うのかな?

もしくは,どうせ enqueue されたことを保証したいのだから amqp ではなく bunny を使う方がいいかもしれない

Bunny:Exchange#publish

subscribe する人

気にせず subscribe を続ければいいんじゃないかな?

その他

amqp のモンキーパッチ

amqp > 0.7.3 で解決されていたので外す ruby-amqp/amqp#94

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment