diff options
| author | Matthew Sackman <matthew@lshift.net> | 2009-10-12 14:56:07 +0100 |
|---|---|---|
| committer | Matthew Sackman <matthew@lshift.net> | 2009-10-12 14:56:07 +0100 |
| commit | 9f1f2a2935e1abb2134b1d8a42245539a3ced2f8 (patch) | |
| tree | 2accfeb92e1d60c8912be5f7390862366bfaf748 | |
| parent | 95851b9ab2968536138371d79cb01633dde4c404 (diff) | |
| download | rabbitmq-server-git-9f1f2a2935e1abb2134b1d8a42245539a3ced2f8.tar.gz | |
Requeue turns out to be vastly more elegant and predictable than in mq.
| -rw-r--r-- | src/rabbit_variable_queue.erl | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/rabbit_variable_queue.erl b/src/rabbit_variable_queue.erl index a9a43fd898..0b4a7689a8 100644 --- a/src/rabbit_variable_queue.erl +++ b/src/rabbit_variable_queue.erl @@ -33,7 +33,7 @@ -export([init/1, publish/3, set_queue_ram_duration_target/2, remeasure_egress_rate/1, fetch/1, ack/2, len/1, is_empty/1, - maybe_start_prefetcher/1, purge/1, delete/1]). + maybe_start_prefetcher/1, purge/1, delete/1, requeue/2]). %%---------------------------------------------------------------------------- @@ -287,6 +287,16 @@ delete(State) -> State1 #vqstate { index_state = IndexState1 }} end. +%% [{Msg, AckTag}] +requeue(MsgsWithAckTags, State) -> + {AckTags, State1} = + lists:foldl( + fun ({Msg, AckTag}, {AckTagsAcc, StateN}) -> + StateN1 = publish(Msg, true, StateN), + {[AckTag | AckTagsAcc], StateN1} + end, {[], State}, MsgsWithAckTags), + ack(AckTags, State1). + %%---------------------------------------------------------------------------- delete1(NextSeqId, Count, GammaSeqId, IndexState) |
