<div style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; ">Matthew,</div><div style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; "><br></div><div><div style="border-collapse: separate; font-family: arial; font-size: small; ">
<font face="arial, sans-serif"><span style="border-collapse: collapse; "><br></span></font></div><div style="border-collapse: separate; font-family: arial; font-size: small; "><font face="arial, sans-serif"><span style="border-collapse: collapse; ">> </span></font><span style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; ">This is very impressive for a first hack on Rabbit.</span></div>
<div style="border-collapse: separate; font-family: arial; font-size: small; "><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; ">Thanks, I'm flattered! :)</span></div>
<div style="border-collapse: separate; font-family: arial; font-size: small; "><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; ">I tried to follow your comments to improve the code...</span></div>
</div><div style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; "><span style="border-collapse:collapse;font-family:arial, sans-serif;font-size:13px"><br></span></div><div style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; ">
<span style="border-collapse:collapse;font-family:arial, sans-serif;font-size:13px"><br></span></div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">> I would imagine you're missing a diff here: surely the handle_call in</span></font><br>
<font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">> amqqueue_process for the mandatory delivery that should be returning</span></font><br><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">
> true|spy?</span></font><div><font face="arial, sans-serif"><span style="border-collapse:collapse"><br></span></font></div><div><font face="arial, sans-serif"><span style="border-collapse:collapse">You're right! I forgot to post that piece, here to everything's not working that well...</span></font></div>
<div><font face="arial, sans-serif"><span style="border-collapse:collapse"><br></span></font></div><div><font face="arial, sans-serif"><span style="border-collapse:collapse"><br></span></font></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">My final list of changes :</span></font></div>
<div><font face="arial, sans-serif"><span style="border-collapse:collapse"><br></span></font></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><b><span class="Apple-style-span" style="font-size: 13px; "><div>
<div style="font-weight: normal; "><div><i><span style="font-style: normal; "><b>rabbit.hrl :</b></span></i></div><div><i>(edition of the amqqueue record, line 47)</i></div><div><i><br></i></div><div><div> -record(amqqueue, {name, durable, auto_delete, exclusive_owner = none, <font class="Apple-style-span" color="#FF0000">spy=false,</font></div>
<div> arguments, pid}).</div></div></div><div style="font-weight: normal; "><br></div><div style="font-weight: normal; "><br></div><div style="font-weight: normal; "><b>rabbit_amqqueue.erl :</b></div><div style="font-weight: normal; ">
<i><br></i></div><div style="font-weight: normal; "><i>(line 115, spec of deliver/2 edited )</i></div><blockquote style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 40px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-weight: normal; ">
<div><i> -spec(deliver/2 :: (pid(), rabbit_types:delivery()) -> boolean()<font class="Apple-style-span" color="#FF0000">|'spy'</font>).</i></div></blockquote><div style="font-weight: normal; "><i><br></i></div>
<div style="font-weight: normal; "><i>(edition of rabbit_amqqueue:deliver/2)</i></div><div style="font-weight: normal; "><i><br></i></div><div style="font-weight: normal; "><div> deliver(QPid, Delivery = #delivery{immediate = true}) -></div>
<div> gen_server2:call(QPid, {deliver_immediately, Delivery}, infinity);</div><div> deliver(QPid, Delivery = #delivery{mandatory = true}) -></div><div> <font class="Apple-style-span" color="#FF0000">case gen_server2:call(QPid, {deliver, Delivery}, infinity) of</font></div>
<div><font class="Apple-style-span" color="#FF0000"> spy -> spy;</font></div><div><font class="Apple-style-span" color="#FF0000"> _ -> true</font></div><div><font class="Apple-style-span" color="#FF0000"> end;</font></div>
<div> deliver(QPid, Delivery) -></div><div> gen_server2:cast(QPid, {deliver, Delivery}),</div><div> true.</div></div><div style="font-weight: normal; "><br></div><div>rabbit_amqqueue_process.erl :</div>
<div style="font-weight: normal; "><br></div><div style="font-weight: normal; "><i>(edition of rabbit_amqqueue_process:declare/3)</i></div><div style="font-weight: normal; "><br></div><div style="font-weight: normal; "><div>
declare(Recover, From, </div><div><span class="Apple-style-span" style="font-size: small; "><b><span class="Apple-style-span" style="font-size: 13px; "><div style="display: inline !important; "><div style="font-weight: normal; display: inline !important; ">
<div style="display: inline !important; "> State = #q{q</div></div></div></span></b></span><span class="Apple-style-span" style="font-size: small; "><b><span class="Apple-style-span" style="font-size: 13px; "><div style="display: inline !important; ">
<div style="font-weight: normal; display: inline !important; "><div style="display: inline !important; "> = <font class="Apple-style-span" color="#CC0000">Qparam</font> = #amqqueue{ </div></div></div></span></b></span><span class="Apple-style-span" style="font-size: small; "><b><span class="Apple-style-span" style="font-size: 13px; "><div style="display: inline !important; ">
<div style="font-weight: normal; display: inline !important; "><div style="display: inline !important; ">name = QName, </div></div></div></span></b></span><span class="Apple-style-span" style="font-size: small; "><b><span class="Apple-style-span" style="font-size: 13px; "><div style="display: inline !important; ">
<div style="font-weight: normal; display: inline !important; "><div style="display: inline !important; ">durable = IsDurable<font class="Apple-style-span" color="#FF0000">, </font></div></div></div></span></b></span><span class="Apple-style-span" style="font-size: small; "><b><span class="Apple-style-span" style="font-size: 13px; "><div style="display: inline !important; ">
<div style="font-weight: normal; display: inline !important; "><div style="display: inline !important; "><font class="Apple-style-span" color="#FF0000">arguments = Args</font> <span class="Apple-style-span" style="font-size: small; "><b><span class="Apple-style-span" style="font-size: 13px; "><div style="display: inline !important; ">
<div style="font-weight: normal; display: inline !important; "><div style="display: inline !important; ">},</div></div></div></span></b></span></div></div></div></span></b></span></div><div> backing_queue = BQ, <span class="Apple-style-span" style="font-size: small; "><b><span class="Apple-style-span" style="font-size: 13px; "><div style="display: inline !important; ">
<div style="font-weight: normal; display: inline !important; "><div style="display: inline !important; ">backing_queue_state = undefined,</div></div></div></span></b></span></div><div><span class="Apple-style-span" style="font-size: small; "><b><span class="Apple-style-span" style="font-size: 13px; "><div style="display: inline !important; ">
<div style="font-weight: normal; display: inline !important; "><div style="display: inline !important; "></div></div></div></span></b></span><span class="Apple-style-span" style="font-size: small; "><b><span class="Apple-style-span" style="font-size: 13px; "><div style="display: inline !important; ">
<div style="font-weight: normal; display: inline !important; "><div style="display: inline !important; "><span class="Apple-style-span" style="font-size: small; "><b><span class="Apple-style-span" style="font-size: 13px; "><div style="display: inline !important; ">
<div style="font-weight: normal; display: inline !important; "><div style="display: inline !important; "> stats_timer = StatsTimer </div></div></div></span></b></span><span class="Apple-style-span" style="font-size: small; "><b><span class="Apple-style-span" style="font-size: 13px; "><div style="display: inline !important; ">
<div style="font-weight: normal; display: inline !important; "><div style="display: inline !important; ">}) -></div></div></div></span></b></span></div></div></div></span></b></span></div><div> <font class="Apple-style-span" color="#FF0000">Spy = case rabbit_misc:table_lookup(Args, <<"spy">>) of </font></div>
<div><font class="Apple-style-span" color="#FF0000"><span class="Apple-tab-span" style="white-space:pre">        </span>{'bool', true} -> true;</font></div><div><font class="Apple-style-span" color="#FF0000"><span class="Apple-tab-span" style="white-space:pre">        </span> _ -> false</font></div>
<div><font class="Apple-style-span" color="#FF0000"> end,</font></div><div><font class="Apple-style-span" color="#FF0000"> Q = Qparam#amqqueue{ spy = Spy},</font></div><div><font class="Apple-style-span" color="#FF0000"> </font>case rabbit_amqqueue:internal_declare(Q, Recover) of</div>
<div> not_found -> {stop, normal, not_found, State};</div><div> Q -> gen_server2:reply(From, {new, Q}),</div><div> ok = file_handle_cache:register_callback(</div><div> rabbit_amqqueue, set_maximum_since_use,</div>
<div> [self()]),</div><div> ok = rabbit_memory_monitor:register(</div><div> self(), {rabbit_amqqueue,</div><div> set_ram_duration_target, [self()]}),</div>
<div> BQS = bq_init(BQ, QName, IsDurable, Recover),</div><div> State1 = process_args(State#q{backing_queue_state = BQS, q=Q}),</div><div> rabbit_event:notify(queue_created,</div>
<div> infos(?CREATION_EVENT_KEYS, State1)),</div><div> rabbit_event:if_enabled(StatsTimer,</div><div> fun() -> emit_stats(State1) end),</div>
<div> noreply(State1);</div><div> Q1 -> {stop, normal, {existing, Q1}, State}</div><div> end.</div><div><br></div><div><br></div><div><i>( edition of rabbit_amqqueue_procces:handle_call({deliver, _} ..., line 846 )</i></div>
<div><br></div><div><div>handle_call({deliver, Delivery}, From, State) -></div><div> %% Synchronous, "mandatory" delivery mode. Reply asap.</div><div> <font class="Apple-style-span" color="#FF0000"> case (State#q.q)#amqqueue.spy of</font></div>
<div><font class="Apple-style-span" color="#FF0000"><span class="Apple-tab-span" style="white-space:pre">        </span>true -> gen_server2:reply(From, spy);</font></div><div><font class="Apple-style-span" color="#FF0000"><span class="Apple-tab-span" style="white-space:pre">        </span>false -> gen_server2:reply(From, true)</font></div>
<div><font class="Apple-style-span" color="#FF0000"> end,</font></div><div> noreply(deliver_or_enqueue(Delivery, State));</div></div><div><br></div><div><br></div></div><div style="font-weight: normal; "><i><span style="font-style: normal; "><b>rabbit_amqqueue_router.erl :</b></span></i></div>
</div><div style="font-weight: normal; "><i>(edition of rabbit_router:fold_deliveries/2, line 105)</i></div><div style="font-weight: normal; "><div><br></div><div> fold_deliveries({Pid, true},{_, Handled}) -> {true, [Pid|Handled]};</div>
<div><font color="#CC0000"> </font><font class="Apple-style-span" color="#FF0000">fold_deliveries({_, spy}, {false, Handled}) -> {false, Handled};</font></div><div> fold_deliveries({_, _},{_, Handled}) -> {true, Handled}.</div>
</div><div style="font-weight: normal; "><br></div></span></b></span></font></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><br></span></font></div>
<div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">I encountered no problem for the moment, testing that feature with the java API.</span></font></div>
<div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><br></span></font></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><br>
</span></font></div><div><div class="gmail_quote">On Fri, Mar 25, 2011 at 4:04 PM, Matthew Sackman <span dir="ltr"><<a href="mailto:matthew@rabbitmq.com" target="_blank">matthew@rabbitmq.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>On Fri, Mar 25, 2011 at 02:58:43PM +0000, Matthew Sackman wrote:<br>
> I'd probably bring that out to a Spy variable. Also, take a look at<br>
> rabbit_misc:table_lookup/2. Also, you might want to delay that<br>
> inspection until you're in amqqueue_process:delay<br>
<br>
</div>Erm, I meant amqqueue_process:declare there. Fingers don't work...<br>
<div><div></div><div><br>
Matthew<br>
_______________________________________________<br>
rabbitmq-discuss mailing list<br>
<a href="mailto:rabbitmq-discuss@lists.rabbitmq.com" target="_blank">rabbitmq-discuss@lists.rabbitmq.com</a><br>
<a href="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss" target="_blank">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><br>
</div></div></blockquote></div><br></div>