<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style id="owaParaStyle" type="text/css">
<!--
p
        {margin-top:0;
        margin-bottom:0}
-->
</style>
</head>
<body>
<div style="direction:ltr; font-family:Tahoma; color:#000000; font-size:10pt">Hi Alan,<br>
<br>
Thanks for your earlier prompt replies. I am simulating a situation to test amqp_basic_publish. I modified the amqp_sendstring example to publish a message to the broker every 3 seconds. While the messages are getting published, I stop the broker using &quot;rabbitmqctl
 stop_app&quot;. As the broker is stopped, amqp_basic_publish is crashed.<br>
<br>
Code snippet as follows.<br>
<br>
<font color="993300">while(1)<br>
{<br>
&nbsp;&nbsp;&nbsp; amqp_basic_properties_t props;<br>
&nbsp;&nbsp;&nbsp; struct timeval t;<br>
&nbsp;&nbsp;&nbsp; int ret;<br>
<br>
&nbsp;&nbsp;&nbsp; t.tv_sec = 3;<br>
&nbsp;&nbsp;&nbsp; t.tv_usec = 0;<br>
&nbsp;&nbsp;&nbsp; select(0, NULL, NULL, NULL, &amp;t);<br>
<br>
&nbsp;&nbsp;&nbsp; props._flags = AMQP_BASIC_CONTENT_TYPE_FLAG | AMQP_BASIC_DELIVERY_MODE_FLAG;<br>
&nbsp;&nbsp;&nbsp; props.content_type = amqp_cstring_bytes(&quot;text/plain&quot;);<br>
&nbsp;&nbsp;&nbsp; props.delivery_mode = 2; /* persistent delivery mode */<br>
&nbsp;&nbsp;&nbsp; printf(&quot;conn %u\n&quot;,conn);<br>
&nbsp;&nbsp;&nbsp; ret=amqp_basic_publish(conn,<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 1,<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; amqp_cstring_bytes(exchange),<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; amqp_cstring_bytes(routingkey),<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 1,<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 0,<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &amp;props,<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; amqp_cstring_bytes(messagebody));<br>
&nbsp;&nbsp;&nbsp; printf(&quot;ret=%d\n&quot;,ret);<br>
}</font><br>
<br>
Program output:<br>
<font color="993300">conn 143663112<br>
ret=0<br>
conn 143663112<br>
ret=0<br>
conn 143663112</font><br>
<br>
First 2 published happened properly. After that I stopped broker. The program terminated. Considering this scenario, I would like to understand<br>
1. if there is a way to check the connection before I publish<br>
2. if the connection value becomes NULL, as we stop the broker.<br>
<br>
Thanks and regards,<br>
Shashank<br>
</div>
<br>
<hr>
<font face="Arial" color="Navy" size="2"><br>
DISCLAIMER:<br>
This email (including any attachments) is intended for the sole use of the intended recipient/s and may contain material that is CONFIDENTIAL AND PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or distribution or forwarding of any or
 all of the contents in this message is STRICTLY PROHIBITED. If you are not the intended recipient, please contact the sender by email and delete all copies; your cooperation in this regard is appreciated.<br>
</font>
</body>
</html>