@@ -99,8 +99,12 @@ serialise_events() -> false.
9999route ( # exchange {name = XName }
100100 , # delivery {message = # basic_message {content = MessageContent , routing_keys = RKs }}
101101 ) ->
102- BindingFuns = get_binding_funs_x (XName ),
103- match_bindings (XName , RKs , MessageContent , BindingFuns ).
102+ case get_binding_funs_x (XName ) of
103+ not_found ->
104+ [];
105+ BindingFuns ->
106+ match_bindings (XName , RKs , MessageContent , BindingFuns )
107+ end .
104108
105109
106110% Before exchange declaration
@@ -232,8 +236,12 @@ selector_match(Selector, Headers) ->
232236get_binding_funs_x (XName ) ->
233237 mnesia :async_dirty (
234238 fun () ->
235- #? JMS_TOPIC_RECORD {x_selector_funs = BindingFuns } = read_state (XName ),
236- BindingFuns
239+ case read_state_no_error (XName ) of
240+ not_found ->
241+ not_found ;
242+ #? JMS_TOPIC_RECORD {x_selector_funs = BindingFuns } ->
243+ BindingFuns
244+ end
237245 end ,
238246 []
239247 ).
@@ -266,16 +274,21 @@ delete_state(XName) ->
266274% Basic read for update
267275read_state_for_update (XName ) -> read_state (XName , write ).
268276
269- % Basic read
270- read_state (XName ) -> read_state (XName , read ).
271-
272277% Lockable read
273278read_state (XName , Lock ) ->
274279 case mnesia :read (? JMS_TOPIC_TABLE , XName , Lock ) of
275280 [Rec ] -> Rec ;
276281 _ -> exchange_state_corrupt_error (XName )
277282 end .
278283
284+ read_state_no_error (XName ) ->
285+ case mnesia :read (? JMS_TOPIC_TABLE , XName , read ) of
286+ [Rec ] -> Rec ;
287+ _ -> not_found
288+ end .
289+
290+
291+
279292% Basic write
280293write_state_fun (XName , BFuns ) ->
281294 mnesia :write ( ? JMS_TOPIC_TABLE
0 commit comments