<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 "rabbitmqctl
stop_app". 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>
amqp_basic_properties_t props;<br>
struct timeval t;<br>
int ret;<br>
<br>
t.tv_sec = 3;<br>
t.tv_usec = 0;<br>
select(0, NULL, NULL, NULL, &t);<br>
<br>
props._flags = AMQP_BASIC_CONTENT_TYPE_FLAG | AMQP_BASIC_DELIVERY_MODE_FLAG;<br>
props.content_type = amqp_cstring_bytes("text/plain");<br>
props.delivery_mode = 2; /* persistent delivery mode */<br>
printf("conn %u\n",conn);<br>
ret=amqp_basic_publish(conn,<br>
1,<br>
amqp_cstring_bytes(exchange),<br>
amqp_cstring_bytes(routingkey),<br>
1,<br>
0,<br>
&props,<br>
amqp_cstring_bytes(messagebody));<br>
printf("ret=%d\n",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>