Browse files

WHISTLE-1441: limit secondary queue bindings to acct/queue

  • Loading branch information...
1 parent 3cecbfe commit 6a7589fe992a4386affee5826753b242d88e1cc0 @jamesaimonetti jamesaimonetti committed Dec 6, 2012
Showing with 8 additions and 8 deletions.
  1. +8 −8 whistle_apps/apps/acdc/src/acdc_queue_manager.erl
View
16 whistle_apps/apps/acdc/src/acdc_queue_manager.erl
@@ -79,11 +79,11 @@
}
]).
--define(SECONDARY_BINDINGS, [{acdc_queue, [{restrict_to, [member_call]}
- ,{account_id, <<"*">>}
- ,{queue_id, <<"*">>}
- ]}
- ]).
+-define(SECONDARY_BINDINGS(AcctId, QueueId), [{acdc_queue, [{restrict_to, [member_call]}
+ ,{account_id, AcctId}
+ ,{queue_id, QueueId}
+ ]}
+ ]).
-define(SECONDARY_QUEUE_NAME, <<"acdc.queue.manager">>).
-define(SECONDARY_QUEUE_OPTIONS, [{exclusive, false}]).
-define(SECONDARY_CONSUME_OPTIONS, [{exclusive, false}]).
@@ -179,7 +179,7 @@ pick_winner(Srv, Resps) ->
%% @end
%%--------------------------------------------------------------------
init([Super, AcctId, QueueId]) ->
- _ = start_secondary_queue(),
+ _ = start_secondary_queue(AcctId, QueueId),
AcctDb = wh_util:format_account_id(AcctId, encoded),
{ok, QueueJObj} = couch_mgr:open_doc(AcctDb, QueueId),
@@ -341,15 +341,15 @@ code_change(_OldVsn, State, _Extra) ->
%%%===================================================================
%%% Internal functions
%%%===================================================================
-start_secondary_queue() ->
+start_secondary_queue(AcctId, QueueId) ->
Self = self(),
spawn(fun() -> gen_listener:add_queue(Self
,?SECONDARY_QUEUE_NAME
,[{queue_options, ?SECONDARY_QUEUE_OPTIONS}
,{consume_options, ?SECONDARY_CONSUME_OPTIONS}
,{basic_qos, 1}
]
- ,?SECONDARY_BINDINGS
+ ,?SECONDARY_BINDINGS(AcctId, QueueId)
)
end).

0 comments on commit 6a7589f

Please sign in to comment.