且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在 Mongooseim 中构建 erlang AMQP 客户端

更新时间:2022-05-01 21:35:42

我发现使用 Jon Brisbin 的钢筋友好型 amqp 库(https://github.com/jbrisbin).我所要做的就是在 rebar.config 文件的依赖项列表中添加 rabbit_common 和 amqp_client repo.

I found its much easier and cleaner using Jon Brisbin's rebar friendly amqp library (https://github.com/jbrisbin). All I had do is to add rabbit_common and amqp_client repo in my dependency list from rebar.config file.

diff --git a/rebar.config b/rebar.config
index c719d98..cafdb0f 100644
--- a/rebar.config
+++ b/rebar.config
@@ -36,6 +36,8 @@
   {pa, ".*", {git, "git://github.com/lavrin/pa.git", "c616d3f9"}},
   {ecoveralls, ".*", {git, "git://github.com/nifoc/ecoveralls.git", "40fa0d2f2057fff29e964f94fccf6ef2f13d34d2"}},
   {mustache, ".*", {git, "git://github.com/mojombo/mustache.erl.git", "d0246fe143058b6404f66cf99fece3ff6e87b7ed"}},
+  {rabbit_common, ".*", {git, "git://github.com/jbrisbin/rabbit_common.git", "rabbitmq-3.5.0"}},
+  {amqp_client, ".*", {git, "git://github.com/jbrisbin/amqp_client.git", {tag, "rabbitmq-3.5.0"}}},
   {recon, "2.2.1", {git, "git://github.com/ferd/recon.git", {tag, "2.2.1"}}}
  ]}.

然后制作并制作rel.我可以使用来自任何 mongooseim 模块的 amqp_client 标头:

Then make and make rel. I can include amqp_client header from any mongooseim module using:

-include_lib("amqp_client/include/amqp_client.hrl").