使用Rabbitmq-amqp1.0-client连接到Azure Service Bus时出现问题

时间:2018-11-06 05:39:23

标签: azure rabbitmq erlang amqp azureservicebus

我正在尝试使用以下erlang客户端连接Azure Service Bus(AMQP 1.0):https://github.com/rabbitmq/rabbitmq-amqp1.0-client

长生不老药包装库https://github.com/pma/amqp似乎不像使用AMQP 1.0。因此,我尝试直接使用erlang客户端。

我做了以下事情:

git clone https://github.com/rabbitmq/rabbitmq-amqp1.0-client.git
cd rabbitmq-amqp1.0-client
make
make shell

然后我根据https://github.com/rabbitmq/rabbitmq-amqp1.0-client

上的自述文件创建了一个配置
OpnConf = #{address => Hostname,
            port => Port,
            hostname => <<"abc-shankardevy.servicebus.windows.net">>,
            tls_opts => {secure_port, [{versions, ['tlsv1.1']}]},
            container_id => <<"test-container">>,
            transfer_limit_margin => 100,
            sasl => {plain, User, Password}}.

当我尝试按照自述文件中的说明打开连接时,出现以下错误。我无法遵循erlang错误消息。任何帮助表示赞赏。

{ok, Connection} = amqp10_client:open_connection(OpnConf).
** exception exit: {noproc,{gen_server,call,
                                       [amqp10_client_sup,
                                        {start_child,[#{address =>
                                                            'abc-shankardevy.servicebus.windows.net',
                                                        container_id => <<"test-container">>,
                                                        hostname => <<"abc-shankardevy.servicebus.windows.net">>,
                                                        notify => <0.111.0>,port => 5671,
                                                        sasl =>
                                                            {plain,'RootManageSharedAccessKey',
                                                                   'mykey'},
                                                        tls_opts => {secure_port,[{versions,['tlsv1.1']}]},
                                                        transfer_limit_margin => 100}]},
                                        infinity]}}
     in function  gen_server:call/3 (gen_server.erl, line 223)
     in call from amqp10_client_connection:open/1 (src/amqp10_client_connection.erl, line 110)

1 个答案:

答案 0 :(得分:1)

尝试先“启动”应用程序:

application:ensure_all_started(amqp10_client).

它抱怨找不到某个进程(noproc),即名为amqp10_client_sup的进程。该过程在启动应用程序时通过this piece of code启动:

-module(amqp10_client_app).

-behaviour(application).

-export([start/2,
         stop/1]).

start(_Type, _Args) ->
    amqp10_client_sup:start_link().