<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
p
{mso-style-priority:99;
mso-margin-top-alt:auto;
margin-right:0in;
margin-bottom:12.0pt;
margin-left:0in;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:black'> I'm new to RabbitMQ and trying to write to a Queue and verify the message was sent. If it fails I need to know about it. I made a fake queue to watch it fail but no matter what I see no exceptions and when I am looking for a ack I always get one. I never see the BasicNack.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:black'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:black'>I'm not even sure i'm the BasicAcks is the way to go.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:black'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:black'><o:p> </o:p></span></p><p class=MsoNormal>private void button1_Click(object sender, EventArgs e)<o:p></o:p></p><p class=MsoNormal> {<o:p></o:p></p><p class=MsoNormal> var factory = new ConnectionFactory() { HostName = "localhost" };<o:p></o:p></p><p class=MsoNormal> using (var connection = factory.CreateConnection())<o:p></o:p></p><p class=MsoNormal> {<o:p></o:p></p><p class=MsoNormal> using (var channel = connection.CreateModel())<o:p></o:p></p><p class=MsoNormal> {<o:p></o:p></p><p class=MsoNormal> channel.QueueDeclare("task_queue", true, false, false, null);<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal> var message = ("Helllo world");<o:p></o:p></p><p class=MsoNormal> var body = Encoding.UTF8.GetBytes(message);<o:p></o:p></p><p class=MsoNormal> channel.ConfirmSelect();<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal> var properties = channel.CreateBasicProperties();<o:p></o:p></p><p class=MsoNormal> properties.SetPersistent(true);<o:p></o:p></p><p class=MsoNormal> properties.DeliveryMode = 2;<o:p></o:p></p><p class=MsoNormal> channel.BasicAcks += channel_BasicAcks;<o:p></o:p></p><p class=MsoNormal> channel.BasicNacks += channel_BasicNacks;<o:p></o:p></p><p class=MsoNormal> //fake queue should be task_queue<o:p></o:p></p><p class=MsoNormal> channel.BasicPublish("", "task_2queue", true, properties, body);<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal> channel.WaitForConfirmsOrDie();<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal> Console.WriteLine(" [x] Sent {0}", message);<o:p></o:p></p><p class=MsoNormal> }<o:p></o:p></p><p class=MsoNormal> }<o:p></o:p></p><p class=MsoNormal> }<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal> void channel_BasicNacks(IModel model, BasicNackEventArgs args)<o:p></o:p></p><p class=MsoNormal> {<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal> }<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal> void channel_BasicAcks(IModel model, BasicAckEventArgs args)<o:p></o:p></p><p class=MsoNormal> {<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal> }<o:p></o:p></p></div></body></html>