1515
1616-define (STATIC_EXCHANGES , [? USER_EVENTS_EX , ? DB_EX , ? NOTIFICATIONS_EX ]).
1717
18- key (List ) -> mqs_lib :key_to_list (List ).
18+ % key(List) -> mqs_lib:key_to_list(List).
1919
2020open (Options ) when is_list (Options ) -> gen_server :call (? MODULE , {open , Options , self ()}).
2121publish (Exchange , RoutingKey , Payload ) -> publish (Exchange , RoutingKey , Payload , []).
@@ -31,7 +31,7 @@ make_connection(State = #state{}) ->
3131 erlang :monitor (process , Connection ),
3232 erlang :monitor (process , Ch ),
3333 # state {connection = Connection , channel = Ch };
34- {error , Reason } -> State end .
34+ {error , _Reason } -> State end .
3535
3636init ([]) ->
3737 process_flag (trap_exit , true ),
@@ -54,12 +54,12 @@ init([]) ->
5454 {ok ,# state {node = NodeName , connection_options = ConnectionOptions }}.
5555
5656handle_call (node_name , _From , # state {node = Node } = State ) -> {reply , {ok , Node }, State };
57- handle_call ({open , Options , DefaultConsumer }, _From , # state { connection = Connection } = State ) ->
57+ handle_call ({open , Options , DefaultConsumer }, _From , State ) ->
5858 case make_connection (State ) of
5959 # state {connection = undefined } -> {reply , {error , cant_establish_mq_connection }, State };
6060 S -> Consumer = mqs_lib :opt (consumer , Options , DefaultConsumer ),
6161 Options1 = mqs_lib :override_opt (consumer , Consumer , Options ),
62- Reply = mqs_channel_sup :start_channel (Connection , Options1 ),
62+ Reply = mqs_channel_sup :start_channel (S # state . connection , Options1 ),
6363 {reply , Reply , S } end ;
6464handle_call ({publish , Exchange , RoutingKey , Payload , Options }, _From , # state {channel = Channel } = State ) ->
6565 case make_connection (State ) of
@@ -85,7 +85,7 @@ terminate(_Reason, #state{connection = Connection}) -> catch amqp_connection:clo
8585
8686code_change (_OldVsn , State , _Extra ) -> {ok , State }.
8787
88- init_static_entries (Ch , Node ) ->
88+ init_static_entries (Ch , _Node ) ->
8989 ExOptions = [durable , {auto_delete , false }],
9090 [ mqs_channel :create_exchange (Ch , Ex , ExOptions ) || Ex <- ? STATIC_EXCHANGES ].
9191
0 commit comments