@@ -99,8 +99,12 @@ serialise_events() -> false.
99
99
route ( # exchange {name = XName }
100
100
, # delivery {message = # basic_message {content = MessageContent , routing_keys = RKs }}
101
101
) ->
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 .
104
108
105
109
106
110
% Before exchange declaration
@@ -232,8 +236,12 @@ selector_match(Selector, Headers) ->
232
236
get_binding_funs_x (XName ) ->
233
237
mnesia :async_dirty (
234
238
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
237
245
end ,
238
246
[]
239
247
).
@@ -266,16 +274,21 @@ delete_state(XName) ->
266
274
% Basic read for update
267
275
read_state_for_update (XName ) -> read_state (XName , write ).
268
276
269
- % Basic read
270
- read_state (XName ) -> read_state (XName , read ).
271
-
272
277
% Lockable read
273
278
read_state (XName , Lock ) ->
274
279
case mnesia :read (? JMS_TOPIC_TABLE , XName , Lock ) of
275
280
[Rec ] -> Rec ;
276
281
_ -> exchange_state_corrupt_error (XName )
277
282
end .
278
283
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
+
279
292
% Basic write
280
293
write_state_fun (XName , BFuns ) ->
281
294
mnesia :write ( ? JMS_TOPIC_TABLE
0 commit comments