[rabbitmq-discuss] erlang client problem?

yaohui yaohui1984 at qq.com
Thu Jun 16 07:13:14 BST 2011


hi,
  
 I use erlang client connecting to rabbitmq broker, when i stop rabbitmq server , in the side of  erlang client, there is a error log, but the client  can send the message all the same without error?
  
 log is like this 
  
 Sending......
Satus:ok.
 =ERROR REPORT==== 16-Jun-2011::13:55:34 ===
** Generic server <0.38.0> terminating 
** Last message in was socket_closed
** When Server state == {state,amqp_network_connection,
                            {state,#Port<0.771>,0,<0.44.0>,131072,
                                {server_initiated_close,320,
                                    <<"CONNECTION_FORCED - broker forced connection closure with reason 'shutdown'">>},
                                false},
                            <0.37.0>,<0.40.0>,
                            {amqp_params_network,<<"goomemq">>,
                                <<"erlang2goomemq">>,<<"/">>,"localhost",5672,
                                0,0,0,none,
                                [#Fun<amqp_auth_mechanisms.plain.3>,
                                 #Fun<amqp_auth_mechanisms.amqplain.3>],
                                []},
                            0,
                            [{<<"capabilities">>,table,
                              [{<<"publisher_confirms">>,bool,true},
                               {<<"exchange_exchange_bindings">>,bool,true},
                               {<<"basic.nack">>,bool,true},
                               {<<"consumer_cancel_notify">>,bool,true}]},
                             {<<"copyright">>,longstr,
                              <<"Copyright (C) 2007-2011 VMware, Inc.">>},
                             {<<"information">>,longstr,
                              <<"Licensed under the MPL.  See http://www.rabbitmq.com/">>},
                             {<<"platform">>,longstr,<<"Erlang/OTP">>},
                             {<<"product">>,longstr,<<"RabbitMQ">>},
                             {<<"version">>,longstr,<<"2.4.0">>}],
                            #Fun<amqp_connection_sup.0.39273983>,
                            #Fun<amqp_connection_sup.2.54430129>,
                            {closing,server_initiated_close,
                                {'connection.close',320,
                                    <<"CONNECTION_FORCED - broker forced connection closure with reason 'shutdown'">>,
                                    0,0},
                                none}}
** Reason for termination == 
** socket_closed_unexpectedly
 Sending......
Satus:ok.
  
  
 my code is like this:
 sendmq() ->
     {ok,Conn1} = amqp_connection:start(#amqp_params_network{username= <<"guest">> ,password= <<"guest">> }),
    {ok,C1} = amqp_connection:open_channel(Conn1),
    Q1 = #'queue.declare'{queue = <<"goome_queue1">>}, #'queue.declare_ok'{}  = amqp_channel:call(C1, Q1),
    E1 = #'exchange.declare'{exchange = <<"goome_exchange1">>}, #'exchange.declare_ok'{} = amqp_channel:call(C1, E1),
    B1 = #'queue.bind'{queue = <<"goome_queue1">>,
                                exchange = <<"goome_exchange1">>,
                                routing_key = <<"goomeRk1">>},
     #'queue.bind_ok'{} = amqp_channel:call(C1, B1),
    P1 = #'basic.publish'{exchange = <<"goome_exchange1">>, routing_key = <<"goomeRk1">>},
         loop(C1,P1).
  
 loop(Channel,Publish)->
        io:format("Sending......~n"),
        Status = amqp_channel:cast(Channel, Publish, #amqp_msg{payload = <<"test">>}),
        io:format("Satus:~p.~n",[Status]),
        timer:sleep(1000),
        loop(Channel,Publish).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20110616/3e005ed5/attachment.htm>


More information about the rabbitmq-discuss mailing list