rabbitmq-c
rabbitmq-c copied to clipboard
client was closed by rabbit-server no reason
i used rabbitmq-c client to comunicate with rabbit server。but a error happened,after i make connect to server successfully,after many seconds about 150 seconds beow,the server closed connection。the server ip is 192.168.1.17,my client ip is 172.16.7.22。here is the screenshot whith wireshark。
who can help me ?
Check if there is some reason given in the server log (if you have access to that). For example, something like
=ERROR REPORT==== 8-Jun-2017::18:49:27 ===
closing AMQP connection <0.459.0> ([::1]:54802 -> [::1]:5672):
missed heartbeats from client, timeout: 1s
Could you provide some sample code that demonstrates the issue?
there is no special code, just as same as the example。
conn = amqp_new_connection();
socket = amqp_tcp_socket_new(conn);
if (!socket) {
die("creating TCP socket");
}
status = amqp_socket_open(socket, hostname, port);
if (status) {
die("opening TCP socket");
}
die_on_amqp_error(amqp_login(conn, "/", 0, 131072, 200, AMQP_SASL_METHOD_PLAIN, MQ_USER, MQ_PSD),
"Logging in");
amqp_channel_open(conn, 1);
die_on_amqp_error(amqp_get_rpc_reply(conn), "Opening channel");
do sth......
sendMQ(........)
int sendMQ(amqp_connection_state_t* conn, const char* exchange, const char* routingkey, const char* messagebody)
{
amqp_basic_properties_t props;
props._flags = AMQP_BASIC_CONTENT_TYPE_FLAG | AMQP_BASIC_DELIVERY_MODE_FLAG;
props.content_type = amqp_cstring_bytes("text/plain");
props.delivery_mode = 2; /* persistent delivery mode */
return amqp_basic_publish(*conn,
1,
amqp_cstring_bytes(exchange),
amqp_cstring_bytes(routingkey),
0,
0,
&props,
amqp_cstring_bytes(messagebody));
}
We met the same problem, any update for this issue? Have u fixed it? Thank you very much. @zhulu-mike