<div class="gmail_quote">On Mon, Jan 28, 2013 at 1:57 PM, Russell Bryant <span dir="ltr"><<a href="mailto:rbryant@redhat.com" target="_blank">rbryant@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 01/28/2013 02:48 PM, Eric Windisch wrote:<br>
>> 31: LOG.error(_("RPC message did not include method."))<br>
>> Why not handle it like AMQP and at least return something. Plus the gain would be some consistency. Here is what AMQP does:<br>
>> if not method:<br>
>> LOG.warn(_('no method for message: %s') % message_data)<br>
>> ctxt.reply(_('No method for message: %s') % message_data,<br>
>> connection_pool=self.connection_pool)<br>
>> return<br>
><br>
><br>
> I began looking to do as you suggest and realized the amqp implemenation might be doing this wrong, too?<br>
><br>
> Isn't this just returning the error as a string back to the caller? What if the method the caller was seeking was returning a string already? What if it was expecting some OTHER data type? Shouldn't this create, serialize, and send an Exception?<br>

><br>
> Perhaps something as simple as the following?<br>
><br>
> ctxt.reply(failure=RPCException(_('No method for message: %s') % message_data)<br>
<br>
Yeah, something like that.  You're right that this is a bug in amqp.py,<br>
it needs to be returning an exception.<br></blockquote><div><br>Actually, it probably doesn't make sense to do very much here.  I now like Eric's idea of simply logging the error and not responding at all.  The most likely reason for not getting a 'method' is the message is totally corrupt, which means it is unlikely to have the msg_id which identifies how to route the response back to the caller.  Therefore, any attempt to respond will probably result in the message being routed to the bit bucket in the sky or at worst cause a stack dump.<br>
<br>Ray<br></div></div>