本文介绍了rabbitmq-erlang客户端,使用钢筋友好的pkg,在dev env上工作失败的钢筋释放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经成功地使用了一个简单的Hello World,OTP兼容的应用程序,并且在开发环境中工作正常。我可以启动一个erl控制台,并执行我的应用程序:start(helloworld)。并连接到代理,打开一个通道并与队列进行通信。 >

然而,然后,我继续执行 rebar生成,它建立的发布很好,但是当我尝试启动从自包含的发行包中,事情突然爆炸。



我知道钢筋版本是一个晦涩的艺术,但我想知道我的选择是什么作为使用rabbitmq-erlang-client的应用程序的部署。



下面你会发现控制台在崩溃时的输出:

  = INFO REPORT ==== 2012年12月18日:: 16:41:35 === 
应用程序:session_record
退出: {{{badmatch,
{error,
{'EXIT',
{undef,
[{amqp_connection_sup,start_link,
[{amqp_params_network, 客人 >>,<< guest>></>>
127.0.0.1,5672,0,0,0,无穷大,无,
[#Fun< amqp_auth_mechanisms.plain.3>
#Fun< amqp_auth_mechanisms.amqplain.3>],
[],[]}],
[]},
{supervisor2,do_start_child_i ,3,
[{file,src / supervisor2.erl},{line,391}]},
{supervisor2,handle_call,3,
[{file,src / supervisor2.erl},{line,413}]},
{gen_server,handle_msg,5,
[{file,gen_server.erl},{line,588}]},
{proc_lib,init_p_do_apply,3,
[{file,proc_lib.erl},{line,227}]}]}}}},
[{amqp_connection,start,1,
[{file,src / amqp_connection.erl},{line,164}]},
{hello_qp,start_link,0,[{file,src / hello_qp.erl},{line ,10}]},
{session_record_sup,init,1,
[{file,src / session_record_supl},{line,55}]},
{supervisor_bridge,init,1,
[{file ,supervisor_bridge.erl},{line,79}]},
{gen_server,init_it,6,[{file,gen_server.erl},{line,304}]},
{proc_lib,init_p_do_apply,3,
[{file,proc_lib.erl},{line,227}]}]},
{session_record_app,start,[normal,[]]}}
type:permanent {Kernel pid terminated,application_controller

编辑: strong>根据评论中的要求。



reltool.config

  {sys,[
{lib_dirs,[..,../deps]},
{erts,[{mod_cond,派生},{app_file,strip}]},
{app_file,strip},
{rel,session_record,0.1.0,
[
kernel,
stdlib,
sasl,
session_rec ord
]},
{rel,start_clean,,
[
kernel,
stdlib
]},
{ boot_rel,session_record},
{profile,embedded},
{incl_cond,derived},
{mod_cond,derived},
{excl_archive_filters,[。*] },%%不归档建立的库
{excl_sys_filters,[^ bin /.*,^ erts。* / bin /(dialyzer | typer),
^ erts。* / (doc | info | include | lib | man | src)]},
{excl_app_filters,[\.gitignore]},
{app,session_record,[{mod_cond,app} {incl_cond,include},{lib_dir,..}]},
{app,hipe,[{incl_cond,exclude}]}
]}。

{target_dir,session_record}。

{overlay,[
{mkdir,log / sasl},
{copy,files / erl,\ {\ {erts_vsn\} \} / bin / erl},
{copy,files / nodetool,\ {\ {erts_vsn\} \} / bin / nodetool},
{copy ,file / session_record,bin / session_record},
{copy,files / session_record.cmd,bin / session_record.cmd},
{copy,files / start_erl cmd,bin / start_erl.cmd},
{copy,files / install_upgrade.escript,bin / install_upgrade.escript},
{copy,files / sys.config ,release / \ {\ {rel_vsn\} \} /sys.config},
{copy,files / vm.args,releases / \ {\ {rel_vsn\\ \\} \} /vm.args}
]}。


解决方案

尝试更改 {mod_cond,派生} {mod_cond,all} 。这意味着,reltool不会试图从包含的应用程序中获取哪些模块。我怀疑你的问题是,reltool没有考虑 amqp_connection_sup 是必要的;您可以通过检查它是否存在于 lib / amqp_client-0.8 / ebin 中来确认。


I am successfully using the rebar-friendly package of rabbitmq-erlang-client for a simple Hello World rebarized and OTP "compliant" app and things work fine on the dev environment. I am able to fire up an erl console and do my application:start(helloworld). and connect to the broker, open up a channel and communicate to queues.

However, then I proceed to do rebar generate and it builds up the release just fine, but when I try to fire up from the self contained release package then things suddenly explode.

I know rebar releases are known to be an obscure art, but I would like to know what are my options as far as deployment for an app using the rabbitmq-erlang-client.

Below you will find the output of the console on the crash:

=INFO REPORT==== 18-Dec-2012::16:41:35 ===
    application: session_record
    exited: {{{badmatch,
               {error,
                {'EXIT',
                 {undef,
                  [{amqp_connection_sup,start_link,
                    [{amqp_params_network,<<"guest">>,<<"guest">>,<<"/">>,
                      "127.0.0.1",5672,0,0,0,infinity,none,
                      [#Fun<amqp_auth_mechanisms.plain.3>,
                       #Fun<amqp_auth_mechanisms.amqplain.3>],
                      [],[]}],
                    []},
                   {supervisor2,do_start_child_i,3,
                    [{file,"src/supervisor2.erl"},{line,391}]}, 
                   {supervisor2,handle_call,3,
                    [{file,"src/supervisor2.erl"},{line,413}]}, 
                   {gen_server,handle_msg,5,
                    [{file,"gen_server.erl"},{line,588}]},
                   {proc_lib,init_p_do_apply,3,
                    [{file,"proc_lib.erl"},{line,227}]}]}}}},
              [{amqp_connection,start,1,
                [{file,"src/amqp_connection.erl"},{line,164}]}, 
               {hello_qp,start_link,0,[{file,"src/hello_qp.erl"},{line,10}]},
               {session_record_sup,init,1,
                [{file,"src/session_record_sup.erl"},{line,55}]},
               {supervisor_bridge,init,1,
                [{file,"supervisor_bridge.erl"},{line,79}]},
               {gen_server,init_it,6,[{file,"gen_server.erl"},{line,304}]},
               {proc_lib,init_p_do_apply,3,
                [{file,"proc_lib.erl"},{line,227}]}]},
             {session_record_app,start,[normal,[]]}}
    type: permanent {"Kernel pid terminated",application_controller

EDIT: As requested in the comments.

reltool.config

{sys, [
       {lib_dirs, ["..", "../deps"]},
       {erts, [{mod_cond, derived}, {app_file, strip}]},
       {app_file, strip},
       {rel, "session_record", "0.1.0",
        [
         kernel,
         stdlib,
         sasl,
         session_record
        ]},
       {rel, "start_clean", "",
        [
         kernel,
         stdlib
        ]},
       {boot_rel, "session_record"},
       {profile, embedded},
       {incl_cond, derived},
       {mod_cond, derived},
       {excl_archive_filters, [".*"]}, %% Do not archive built libs
       {excl_sys_filters, ["^bin/.*", "^erts.*/bin/(dialyzer|typer)",
                           "^erts.*/(doc|info|include|lib|man|src)"]},
       {excl_app_filters, ["\.gitignore"]},
       {app, session_record, [{mod_cond, app}, {incl_cond, include}, {lib_dir, ".."}]},
       {app, hipe, [{incl_cond, exclude}]}
      ]}.

{target_dir, "session_record"}.

{overlay, [
           {mkdir, "log/sasl"},
           {copy, "files/erl", "\{\{erts_vsn\}\}/bin/erl"},
           {copy, "files/nodetool", "\{\{erts_vsn\}\}/bin/nodetool"},
           {copy, "files/session_record", "bin/session_record"},
           {copy, "files/session_record.cmd", "bin/session_record.cmd"},
           {copy, "files/start_erl.cmd", "bin/start_erl.cmd"},
           {copy, "files/install_upgrade.escript", "bin/install_upgrade.escript"},
           {copy, "files/sys.config", "releases/\{\{rel_vsn\}\}/sys.config"},
           {copy, "files/vm.args", "releases/\{\{rel_vsn\}\}/vm.args"}
          ]}.
解决方案

Try changing {mod_cond, derived} to {mod_cond, all}. That means that reltool will not try to be clever about which modules to take from the included applications. I suspect that your problem is that reltool didn't consider amqp_connection_sup to be necessary; you could confirm that by checking whether it's present in lib/amqp_client-0.8/ebin.

这篇关于rabbitmq-erlang客户端,使用钢筋友好的pkg,在dev env上工作失败的钢筋释放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-23 05:51