[rabbitmq-discuss] AMQP Erlang client

Michael Vierling MVierling at attinteractive.com
Sun Feb 6 17:23:16 GMT 2011


Has the Erlang AMQP client code changed recently?  We are attempting to get the metronome plugin to work.  However the following code seems no longer to work:

init([]) ->
  Connection = amqp_connection:start_direct(),
  Channel = amqp_connection:open_channel(Connection),
  amqp_channel:call(Channel, #'exchange.declare'{exchange = <<"metronome">>,
                                                 type = <<"topic">>}),

In the current code, the start_direct function no longer exists.  So I've replaced it with start.

init([]) ->
  Connection = amqp_connection:start(direct),
  Channel = amqp_connection:open_channel(Connection),
  amqp_channel:call(Channel, #'exchange.declare'{exchange = <<"metronome">>,
                                                 type = <<"topic">>}),

However it still doesn't work.

(rabbit at rabbit9)6> Channel = amqp_connection:open_channel(Connection).
** exception exit: {{function_clause,[{gen,call,
                                           [{ok,<0.1066.0>},
                                            '$gen_call',
                                            {command,{open_channel,none}},
                                            infinity]},
                                      {gen_server,call,3},
                                      {amqp_gen_connection,open_channel,2},
                                      {erl_eval,do_apply,5},
                                      {erl_eval,expr,5},
                                      {shell,exprs,7},
                                      {shell,eval_exprs,7},
                                      {shell,eval_loop,3}]},
                    {gen_server,call,
                                [{ok,<0.1066.0>},{command,{open_channel,none}},infinity]}}
     in function  gen_server:call/3
     in call from amqp_gen_connection:open_channel/2
(rabbit at rabbit9)7>

Any ideas?

Thanks,
Michael


More information about the rabbitmq-discuss mailing list