Rabbitmq message sending error
I try to send messsage to rabbitmq-server:
send_message(Channel, Host, Password, Message) ->
amqp_channel:cast(Channel, #'basic.publish'{exchange = <<"">&g开发者_运维技巧t;},
routing_key = <<"test">>,
#amqp_msg{payload = Message}).
But get error:
Error in process <0.431.0> with exit value:
{function_clause,[{gen_server,cast, [2,{cast,{'basic.publish',0,<<0
bytes>>,<<7 bytes>>,false,false},
{amqp_msg,{'P_basic',undefined,undefined,undefined,undefined,undefined,undefined,
undefined,undefined,undefined,undefined,undefined...
How can i fix it? How can i correctly send message to rabbitmq-server?
Thank you.
Check the value of Channel: from the stacktrace it shows that it is equal to 2, which is not a valid Pid.
The code calling send_message/4 must do something funky and not pass a valid Channel to it.
精彩评论