本文介绍了如何在Mongooseim中构建erlang AMQP客户端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来的erlang。我正在尝试用我的mongoose源构建RabitMQ Erlang AMQP客户端库,以便我可以在我的mongooseim模块中使用库。我从下载了图书馆来源。 .ez文件包含两个目录,ebin和include。 ebin包含.beam文件,包含erlang .hrl文件。如果我将所有.hrl文件放入mongooseim的apps / ejabberd / include目录中,并将所有.beam文件放入ebin目录,它会工作吗?我正在使用make和make rel来编译mongooseim。

解决方案

我发现使用Jon Brisbin的钢筋友好的amqp库()。我所做的只是在我的依赖列表中从rebar.config文件中添加rabbit_common和amqp_client repo。

  diff --git a /rebar.config b / rebar.config 
索引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, ://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 }}}
]}。

然后make和make rel。我可以使用以下方式包含任何mongooseim模块的amqp_client头:

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


I am new in erlang. I am trying to build RabitMQ Erlang AMQP client library with my mongoose source so that I can use the library within my mongooseim modules. I downloaded the library source from here. The .ez file contains two directories, ebin and includes. ebin contains .beam files and include contains erlang .hrl files. Will it work if I drop all the .hrl files into mongooseim's apps/ejabberd/include directory and all .beam files into ebin directory? I am using make and make rel for compiling mongooseim.

解决方案

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"}}}
  ]}.

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

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

这篇关于如何在Mongooseim中构建erlang AMQP客户端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-06 07:11