<div dir="ltr">Nothing obvious stands out. <div><br></div><div>What kind of crash are you getting? Run it under a debugger and see where it crashes?</div><div><br></div><div>-Alan</div><div><br></div><div><br></div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Mon, Nov 18, 2013 at 1:50 PM, Kiran Kumar <span dir="ltr"><<a href="mailto:kirankumar.pnm@gmail.com" target="_blank">kirankumar.pnm@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">I have a rabbitmq server running on my debian linux machine. I have a BGP process running and it prepared a Route Message using google protocol buffers. The protocol buffer returns a binary data buffer.<br>
<br>Then I have below code to send this data to rabbitmq server. When I execute this, the process crashes on amqp_basic_publish call. <br><br>Any thoughts on this ? Am I missing some thing here ?<br><br><br>int bgp_mq_send(char const* rt_msg, int size)<br>
{<br> static int init_done = 0;<br> int status;<br> amqp_socket_t *socket = NULL;<br> amqp_connection_state_t conn = NULL;<br> amqp_rpc_reply_t reply;<br><br> if (init_done == 0) {<br> conn = amqp_new_connection();<br>
<br> socket = amqp_tcp_socket_new(conn);<br> if (!socket) {<br> printf("\n socket creation failed\n");<br> return 1;<br> }<br><br> status = amqp_socket_open(socket, "localhost", 5672);<br>
if (status) {<br> printf("\n socket open failed\n");<br> return 1;<br> }<br><br> reply = amqp_login(conn, "/", 0, 131072, 0, <font size="1">AMQP_SASL_METHOD_PLAIN</font>, "guest", "guest");<br>
if (reply.reply_type) {<br> printf("\n Login is failed\n");<br> }<br><br> amqp_channel_open(conn, 1);<br> reply = amqp_get_rpc_reply(conn);<br> if (reply.reply_type) {<br>
printf("\n get_reply failed\n");<br> }<br> init_done = 1;<br> }<br><br><br> {<br> amqp_basic_properties_t props;<br> props._flags = <font size="1">AMQP_BASIC_CONTENT_TYPE_FLAG | AMQP_BASIC_DELIVERY_MODE_FLAG</font>;<br>
props.content_type = amqp_cstring_bytes("gpb");<br> props.content_encoding = amqp_cstring_bytes("binary");<br> props.delivery_mode = 2; /* persistent delivery mode */<br><br> amqp_bytes_t str2;<br>
str2.len = size;<br> str2.bytes = rt_msg;<br><br> status = amqp_basic_publish(conn, 1, amqp_cstring_bytes("amq.fanout"),<br> amqp_cstring_bytes("#"), 0, 0,<br>
&props, str2); <b><<<----------- It crashes right here.</b> <br><br> if (status < 0) {<br> printf("\n publish failed\n");<br> }<br> printf("\n Publish success\n");<br>
}<br> reply = amqp_channel_close(conn, 1, AMQP_REPLY_SUCCESS);<br> if (reply.reply_type) {<br> printf("\n chan close failed\n");<br> }<br> reply = amqp_connection_close(conn, AMQP_REPLY_SUCCESS);<br>
if (reply.reply_type) {<br> printf("\n conn close failed\n");<br> }<br> status = amqp_destroy_connection(conn);<br> if (status < 0) {<br> printf("\n Destroy failed\n");<br>
}<br> printf("\n All Done\n");<br> return 0;<br>}<br><br>any help in moving forward would be great.<br><br>Thanks,<br>Kiran.<br></div><br>_______________________________________________<br>
rabbitmq-discuss mailing list<br>
<a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a><br>
<a href="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss" target="_blank">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><br>
<br></blockquote></div><br></div>