[rabbitmq-discuss] Error while connect to rabbitmq using rabbitmq-erlang-client library
Fisher Yu
fisher at yun.io
Tue Aug 2 14:43:46 BST 2011
Hi
I kept get error message while connect to rabbitmq server using
rabbitmq-erlang-client library. Anyone can help, thanks.
Erlang R14B03 (erts-5.8.4) [source] [64-bit] [smp:24:24] [rq:24]
[async-threads:0] [kernel-poll:false]
Eshell V5.8.4 (abort with ^G)
1> test:start().
=ERROR REPORT==== 2-Aug-2011::08:40:18 ===
** Generic server <0.46.0> terminating
** Last message in was
{inet_async,#Port<0.1109>,1,{ok,<<65,77,81,80,1,1,8>>}}
** When Server state == {state,#Port<0.1109>,<0.39.0>,<0.41.0>,
{method,rabbit_framing_amqp_0_9_1},
none}
** Reason for termination ==
** {{badmatch,{error,enomem}},
[{amqp_main_reader,handle_inet_async,2},
{gen_server,handle_msg,5},
{proc_lib,init_p_do_apply,3}]}
%%test.erl
-module(test).
-include_lib("amqp_client/include/amqp_client.hrl").
-compile(export_all).
start() ->
{ok, Connection} =
amqp_connection:start(#amqp_params_network{username= <<"myuser">>, password=
<<"mypassword">>}),
{ok, Channel} = amqp_connection:open_channel(Connection),
Queue = "my_queue",
Declare = #'queue.declare'{queue = list_to_binary(Queue),
durable=true},
#'queue.declare_ok'{} = amqp_channel:call(Channel, Declare),
Get = #'basic.get'{queue = Queue},
{#'basic.get_ok'{delivery_tag = Tag}, Content}
= amqp_channel:call(Channel, Get),
io:format("received message ~p", [Content]),
%% Close the channel
amqp_channel:close(Channel),
%% Close the connection
amqp_connection:close(Connection),
ok.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20110802/81a66697/attachment.htm>
More information about the rabbitmq-discuss
mailing list