<div dir="ltr">Hi Michael, had to decompile RabbitMQ.Client assembly and step through to find the issue.  Apparently, my code doesn't always pass a non-null messageId.  Setting a null messageId on the basicproperties is allowed but the writing of a null messageId on the wire will cause an error inside of RabbitMQ.Client.  So moral of the story is don't ever set a basicproperties property unless it's non null (at least as of RabbitMQ.Client 3.3.0).<div>
<br></div><div>I put connection and channel logic back in the same method and it works great.   Here is new working version.</div><div><br></div><div><div>private void PublishMessage(byte[] message, Type messageType, string contentType, string messageId)</div>
<div><span class="" style="white-space:pre">    </span>        {</div><div><span class="" style="white-space:pre">      </span>            if (message == null || message.Length == 0)</div><div><span class="" style="white-space:pre">      </span>            {</div>
<div><span class="" style="white-space:pre">    </span>                throw new ArgumentNullException("message");    </div><div><span class="" style="white-space:pre">        </span>            }</div><div><span class="" style="white-space:pre">        </span></div>
<div><span class="" style="white-space:pre">    </span>            if (messageType == null)</div><div><span class="" style="white-space:pre"> </span>            {</div><div><span class="" style="white-space:pre">        </span>                throw new ArgumentNullException("messageType");</div>
<div><span class="" style="white-space:pre">    </span>            }</div><div><span class="" style="white-space:pre">        </span></div><div><span class="" style="white-space:pre">   </span>            if (String.IsNullOrEmpty(contentType))</div>
<div><span class="" style="white-space:pre">    </span>            {</div><div><span class="" style="white-space:pre">        </span>                throw new ArgumentNullException("contentType");</div><div><span class="" style="white-space:pre">  </span>            }</div>
<div><span class="" style="white-space:pre">    </span></div><div><span class="" style="white-space:pre">   </span>//            if (String.IsNullOrEmpty(messageId))</div><div><span class="" style="white-space:pre">   </span>//            {</div>
<div><span class="" style="white-space:pre">    </span>//                throw new ArgumentNullException("messageId");</div><div><span class="" style="white-space:pre">  </span>//            }</div><div><span class="" style="white-space:pre">      </span></div>
<div><span class="" style="white-space:pre">    </span>            var factory = new ConnectionFactory() {VirtualHost = this.VirtualHost, HostName = this.Host, UserName = this.User, Password = this.Password };</div><div><span class="" style="white-space:pre">   </span>            using (var connection = factory.CreateConnection())</div>
<div><span class="" style="white-space:pre">    </span>            using (var channel = connection.CreateModel())</div><div><span class="" style="white-space:pre">   </span>            {</div><div><span class="" style="white-space:pre">        </span>                IBasicProperties props = channel.CreateBasicProperties();</div>
<div><span class="" style="white-space:pre">    </span>                props.SetPersistent(this.PersistMessages);</div><div><span class="" style="white-space:pre"> </span>                </div><div><span class="" style="white-space:pre">   </span>                //Mime time</div>
<div><span class="" style="white-space:pre">    </span>                props.ContentType = contentType;</div><div><span class="" style="white-space:pre">   </span>                props.Type = messageType.FullName;</div><div><span class="" style="white-space:pre"> </span></div>
<div><span class="" style="white-space:pre">    </span>                if (!String.IsNullOrEmpty(messageId))</div><div><span class="" style="white-space:pre">      </span>                {</div><div><span class="" style="white-space:pre">  </span>                    //Must be careful not to set IBasicProperties with possible null value as this will cause serialization errors downstream (RabbitMQ.Client 3.3.0)</div>
<div><span class="" style="white-space:pre">    </span>                    props.MessageId = messageId;    </div><div><span class="" style="white-space:pre">   </span>                }<span class="" style="white-space:pre"> </span></div>
<div><span class="" style="white-space:pre">    </span></div><div><span class="" style="white-space:pre">   </span>                //Note, may get AlreadyClosedException here if publishing to a incorrect exchange name</div><div>
<span class="" style="white-space:pre">       </span>                channel.BasicPublish(this.ExchangeName, this.RoutingKey, props, message);</div><div><span class="" style="white-space:pre">  </span>            }</div><div>        }</div>
</div><div><div><br></div></div><div>thanks for the help.</div><div><br></div><div>scott</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jun 18, 2014 at 10:05 PM, Michael Klishin <span dir="ltr"><<a href="mailto:mklishin@gopivotal.com" target="_blank">mklishin@gopivotal.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class=""> On 19 June 2014 at 07:02:17, Scott McFadden (<a href="mailto:scott.kendall.mcfadden@gmail.com">scott.kendall.mcfadden@gmail.com</a>) wrote:<br>

> > It makes me think I screwed up the server side configuration<br>
> when reinstalling.<br>
<br>
</div>There is no configuration that can affect framing/frame interleaving in the client.<br>
This is also the kind of issues that we'd see reported constantly if it was a client<br>
issue. Finally, it happens on a brand new connection.<br>
<br>
I'd recommend doing two things:<br>
<br>
 * Running a tracer proxy in front of RabbitMQ [1] to see what's being sent on the wire<br>
 * Open a connection on app start if you can instead of opening a new one per channel<br>
<br>
If the latter does not change anything, please post the output of the tracer.<br>
<br>
1. <a href="http://www.rabbitmq.com/java-tools.html" target="_blank">http://www.rabbitmq.com/java-tools.html</a>, see Tracer<br>
<div class="HOEnZb"><div class="h5">--<br>
MK<br>
<br>
Software Engineer, Pivotal/RabbitMQ<br>
</div></div></blockquote></div><br></div>