[rabbitmq-discuss] More RabbitMQ Erlang client woes
Edwin Fine
rabbitmq-discuss_efine at usa.net
Fri May 9 16:05:06 BST 2008
I wrote:
"Please understand that all the code I have submitted (other than
amqp_channel) is a pure hack to try to expose and duplicate the errors!".
That should have read, "other than rbmq_admin.erl" - the module that I wrote
to do admin tasks, which is only a semi-hack ;-)
Ed
On Fri, May 9, 2008 at 9:30 AM, Edwin Fine <rabbitmq-discuss_efine at usa.net>
wrote:
> Ben,
>
>>
>> In your patch, you also added an extra method to handle a spurious
>> consume_ok message;
>>
>> %% Edwin Fine bugfix: This is actually being called wrong from somewhere,
>> %% but this will fix it.
>> handle_method({'basic.consume_ok', ConsumerTag}, State) ->
>> io:format("[~p] Got bad handle_method call!~n", [self()]),
>> handle_method(#'basic.consume_ok'{consumer_tag = ConsumerTag}, State);
>>
>> This method is preceded in the code by the following function:
>>
>> handle_method(BasicConsumeOk = #'basic.consume_ok'{consumer_tag =
>> ConsumerTag},
>> State = #channel_state{pending_consumer =
>> Consumer}) ->
>> Consumer ! BasicConsumeOk,
>> NewState = register_consumer(ConsumerTag, Consumer, State),
>> {noreply, NewState2} = rpc_bottom_half(BasicConsumeOk, NewState),
>> {noreply, NewState2#channel_state{pending_consumer = <<>>} };
>>
>> So I not quite sure why that didn't match first
>> because #'basic.consume_ok'{consumer_tag = ConsumerTag} should match
>> against {'basic.consume_ok', ConsumerTag}
>> and #channel_state{pending_consumer = Consumer} should match even if the
>> pending_consumer was not defined.
>>
>
> Actually, I was in the middle of trying to get that right, and it was late,
> so I would ignore that comment (and the code) completely. In fact I have
> removed it from the most recent code. I was trying to get rid of the error
> that I saw in the stack trace of the amqp_channel, namely
>
> ** Reason for termination ==
> ** {badarg,[{amqp_channel,handle_method,2},
> {gen_server,handle_msg,5},
> {proc_lib,init_p,5}]}
>
> Now that I am doing the basic.consume in the process that starts the
> consumers, the above issue does not occur.
> Thanks for all your help. In the meantime, until you have a more elegant
> bugfix (to the rabbit_writer proliferation) than my hack, I will just
> continue to use my modified Erlang client.
>
> Ben, you also wrote:
>
> >>> That's a good point. I think the cleanup code should go into the
> gen_server terminate callback to keep it one place.
>
> Funny thing, that - I *did* put the cleanup code into the terminate, but it
> did not seem to be called. It was only when I put it directly before the
> {stop, xxx} returns that it finally got called. Again, this may have just
> been late night syndrome, but I had extensive print statements and could
> clearly see that it was not happening. At that time all I wanted was to get
> it to work. Please understand that all the code I have submitted (other than
> amqp_channel) is a pure hack to try to expose and duplicate the errors!
>
> Thanks again.
> Regards,
> Ed
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20080509/4fe9d664/attachment.htm
More information about the rabbitmq-discuss
mailing list