Erlang AMQP Client error for Azure Service Bus

erlang

#1

I’m trying to connect Azure Service Bus (AMQP 1.0) using this erlang client: https://github.com/rabbitmq/rabbitmq-amqp1.0-client

The elixir wrapper library https://github.com/pma/amqp doesn’t seem like using AMQP 1.0. So I’m trying to use the erlang client directly.

I did the following:

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

Then I created a config as per the README file at 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}}.

When I try to open the connection as in the README, I get the following error. I’m not able to follow the erlang error message. Any help is appreciated.

{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)

#2

There is no process with the name :amqp10_client_sup, have you started the supervision tree correctly?


#3

I thought amqp10_client:open_connection/1 will create the supervisor. Will check. Do you by any chance know how to start it? Docs are sparse and any help is greatly appreciate.


#4

Why are you using the Erlang AMQP client rather than the Elixir one? The latter at least has better documentation than the former. :slight_smile:


#5

if you are referring to Elixir client: https://github.com/pma/amqp , it doesn’t support AQMP 1.0.


#6

I do not use that library, I just told you what the error message is about :wink: Usually the supervision tree is set up when starting the application. Usually this happens implicitely, depending on the build system you use and how you specified the dependency.

Th repo you linked has no app file in src/ and uses erlang.mk for building, so I have no clue if the application entrypoint is actually properly advertised by the amqp library.

One of these should work:

Application.ensure_all_started(:amqp10_client_app) # maybe without `_app` suffix
# or
:amqp10_client_app.start(:temporary, [])

But the first version is to prefer over everything else, as the latter bypasses a lot of the BEAMs internal application supervision.


#7

Thank you @NobbZ . This answer in SO https://stackoverflow.com/a/53169287/2623771 works for me. Basically, the erlang version of your answer.

application:ensure_all_started(amqp10_client).

Note the app name is amqp10_client without the _app suffix.


#8

I didn’t realize you were hacking Erlang, I thought you were trying to interface the Erlang library from elixir.


#9

Ah, I see :sweat_smile:.