开发者

Rabbitmq message sending error

开发者 https://www.devze.com 2023-03-16 00:42 出处:网络
I try to send messsage to rabbitmq-server: send_message(Channel, Host, Password, Message) -> amqp_channel:cast(Channel, #\'basic.publish\'{exchange = <<\"\">&g开发者_运维技巧t;},

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号