summaryrefslogtreecommitdiff
path: root/src/rabbit_backing_queue.erl
diff options
context:
space:
mode:
authorMatthew Sackman <matthew@rabbitmq.com>2011-04-08 12:03:42 +0100
committerMatthew Sackman <matthew@rabbitmq.com>2011-04-08 12:03:42 +0100
commit1392afc76e534fd9cfbfd716c57777ff50c8b76e (patch)
tree994d63fbe03956630f0ede014c237739efe6a778 /src/rabbit_backing_queue.erl
parent644af26c9866e6af05dd58cd1cd02b39c8933647 (diff)
downloadrabbitmq-server-1392afc76e534fd9cfbfd716c57777ff50c8b76e.tar.gz
Extensions to BQ
Diffstat (limited to 'src/rabbit_backing_queue.erl')
-rw-r--r--src/rabbit_backing_queue.erl37
1 files changed, 27 insertions, 10 deletions
diff --git a/src/rabbit_backing_queue.erl b/src/rabbit_backing_queue.erl
index 0ca8d260..0955a080 100644
--- a/src/rabbit_backing_queue.erl
+++ b/src/rabbit_backing_queue.erl
@@ -35,19 +35,18 @@ behaviour_info(callbacks) ->
%% Initialise the backing queue and its state.
%%
%% Takes
- %% 1. the queue name
- %% 2. a boolean indicating whether the queue is durable
- %% 3. a boolean indicating whether the queue is an existing queue
+ %% 1. the amqqueue record
+ %% 2. a boolean indicating whether the queue is an existing queue
%% that should be recovered
- %% 4. an asynchronous callback which accepts a function of type
+ %% 3. an asynchronous callback which accepts a function of type
%% backing-queue-state to backing-queue-state. This callback
%% function can be safely invoked from any process, which
%% makes it useful for passing messages back into the backing
%% queue, especially as the backing queue does not have
%% control of its own mailbox.
- %% 5. a synchronous callback. Same as the asynchronous callback
+ %% 4. a synchronous callback. Same as the asynchronous callback
%% but waits for completion and returns 'error' on error.
- {init, 5},
+ {init, 4},
%% Called on queue shutdown when queue isn't being deleted.
{terminate, 1},
@@ -61,12 +60,12 @@ behaviour_info(callbacks) ->
{purge, 1},
%% Publish a message.
- {publish, 3},
+ {publish, 4},
%% Called for messages which have already been passed straight
%% out to a client. The queue will be empty for these calls
%% (i.e. saves the round trip through the backing queue).
- {publish_delivered, 4},
+ {publish_delivered, 5},
%% Return ids of messages which have been confirmed since
%% the last invocation of this function (or initialisation).
@@ -109,7 +108,7 @@ behaviour_info(callbacks) ->
{ack, 2},
%% A publish, but in the context of a transaction.
- {tx_publish, 4},
+ {tx_publish, 5},
%% Acks, but in the context of a transaction.
{tx_ack, 3},
@@ -165,7 +164,25 @@ behaviour_info(callbacks) ->
%% Exists for debugging purposes, to be able to expose state via
%% rabbitmqctl list_queues backing_queue_status
- {status, 1}
+ {status, 1},
+
+ %% Passed a function to be invoked with the relevant backing
+ %% queue's state. Useful for when the backing queue or other
+ %% components need to pass functions into the backing queue.
+ {invoke, 3},
+
+ %% Called prior to a publish or publish_delivered call. Allows
+ %% the BQ to signal that it's already seen this message (and in
+ %% what capacity - i.e. was it published previously or discarded
+ %% previously) and thus the message should be dropped.
+ {is_duplicate, 3},
+
+ %% Called to inform the BQ about messages which have reached the
+ %% queue, but are not going to be further passed to BQ for some
+ %% reason. Note that this is may be invoked for messages for
+ %% which BQ:is_duplicate/2 has already returned {'published' |
+ %% 'discarded', BQS}.
+ {discard, 3}
];
behaviour_info(_Other) ->
undefined.