@@ -65,17 +65,16 @@ def test_stream_read_from_last(
65
65
66
66
addr_queue = AddressHelper .queue_address (stream_name )
67
67
68
- stream_filter_options = StreamOptions ()
69
- stream_filter_options .offset (OffsetSpecification .last )
70
-
71
68
# consume and then publish
72
69
try :
73
70
connection_consumer = environment .connection ()
74
71
connection_consumer .dial ()
75
72
consumer = connection_consumer .consumer (
76
73
addr_queue ,
77
74
message_handler = MyMessageHandlerAcceptStreamOffset (),
78
- stream_filter_options = stream_filter_options ,
75
+ stream_filter_options = StreamOptions (
76
+ offset_specification = OffsetSpecification .last
77
+ ),
79
78
)
80
79
publish_messages (connection , messages_to_send , stream_name )
81
80
consumer .run ()
@@ -107,16 +106,13 @@ def test_stream_read_from_offset_zero(
107
106
# publish and then consume
108
107
publish_messages (connection , messages_to_send , stream_name )
109
108
110
- stream_filter_options = StreamOptions ()
111
- stream_filter_options .offset (0 )
112
-
113
109
try :
114
110
connection_consumer = environment .connection ()
115
111
connection_consumer .dial ()
116
112
consumer = connection_consumer .consumer (
117
113
addr_queue ,
118
114
message_handler = MyMessageHandlerAcceptStreamOffset (0 ),
119
- stream_filter_options = stream_filter_options ,
115
+ stream_filter_options = StreamOptions ( offset_specification = 0 ) ,
120
116
)
121
117
122
118
consumer .run ()
@@ -148,16 +144,13 @@ def test_stream_read_from_offset_first(
148
144
# publish and then consume
149
145
publish_messages (connection , messages_to_send , stream_name )
150
146
151
- stream_filter_options = StreamOptions ()
152
- stream_filter_options .offset (OffsetSpecification .first )
153
-
154
147
try :
155
148
connection_consumer = environment .connection ()
156
149
connection_consumer .dial ()
157
150
consumer = connection_consumer .consumer (
158
151
addr_queue ,
159
152
message_handler = MyMessageHandlerAcceptStreamOffset (0 ),
160
- stream_filter_options = stream_filter_options ,
153
+ stream_filter_options = StreamOptions ( OffsetSpecification . first ) ,
161
154
)
162
155
163
156
consumer .run ()
@@ -189,16 +182,13 @@ def test_stream_read_from_offset_ten(
189
182
# publish and then consume
190
183
publish_messages (connection , messages_to_send , stream_name )
191
184
192
- stream_filter_options = StreamOptions ()
193
- stream_filter_options .offset (10 )
194
-
195
185
try :
196
186
connection_consumer = environment .connection ()
197
187
connection_consumer .dial ()
198
188
consumer = connection_consumer .consumer (
199
189
addr_queue ,
200
190
message_handler = MyMessageHandlerAcceptStreamOffset (10 ),
201
- stream_filter_options = stream_filter_options ,
191
+ stream_filter_options = StreamOptions ( offset_specification = 10 ) ,
202
192
)
203
193
204
194
consumer .run ()
@@ -228,15 +218,13 @@ def test_stream_filtering(connection: Connection, environment: Environment) -> N
228
218
229
219
# consume and then publish
230
220
try :
231
- stream_filter_options = StreamOptions ()
232
- stream_filter_options .filter_values (["banana" ])
233
221
connection_consumer = environment .connection ()
234
222
connection_consumer .dial ()
235
223
236
224
consumer = connection_consumer .consumer (
237
225
addr_queue ,
238
226
message_handler = MyMessageHandlerAcceptStreamOffset (),
239
- stream_filter_options = stream_filter_options ,
227
+ stream_filter_options = StreamOptions ( filters = [ "banana" ]) ,
240
228
)
241
229
# send with annotations filter banana
242
230
publish_messages (connection , messages_to_send , stream_name , ["banana" ])
@@ -268,15 +256,13 @@ def test_stream_filtering_mixed(
268
256
269
257
# consume and then publish
270
258
try :
271
- stream_filter_options = StreamOptions ()
272
- stream_filter_options .filter_values (["banana" ])
273
259
connection_consumer = environment .connection ()
274
260
connection_consumer .dial ()
275
261
consumer = connection_consumer .consumer (
276
262
addr_queue ,
277
263
# check we are reading just from offset 10 as just banana filtering applies
278
264
message_handler = MyMessageHandlerAcceptStreamOffset (10 ),
279
- stream_filter_options = stream_filter_options ,
265
+ stream_filter_options = StreamOptions ( filters = [ "banana" ]) ,
280
266
)
281
267
# send with annotations filter apple and then banana
282
268
# consumer will read just from offset 10
@@ -309,13 +295,11 @@ def test_stream_filtering_not_present(
309
295
addr_queue = AddressHelper .queue_address (stream_name )
310
296
311
297
# consume and then publish
312
- stream_filter_options = StreamOptions ()
313
- stream_filter_options .filter_values (["apple" ])
314
298
connection_consumer = environment .connection ()
315
299
connection_consumer .dial ()
316
300
317
301
consumer = connection_consumer .consumer (
318
- addr_queue , stream_filter_options = stream_filter_options
302
+ addr_queue , stream_filter_options = StreamOptions ( filters = [ "apple" ])
319
303
)
320
304
# send with annotations filter banana
321
305
publish_messages (connection , messages_to_send , stream_name , ["banana" ])
@@ -351,15 +335,14 @@ def test_stream_match_unfiltered(
351
335
352
336
# consume and then publish
353
337
try :
354
- stream_filter_options = StreamOptions ()
355
- stream_filter_options .filter_values (["banana" ])
356
- stream_filter_options .filter_match_unfiltered (True )
357
338
connection_consumer = environment .connection ()
358
339
connection_consumer .dial ()
359
340
consumer = connection_consumer .consumer (
360
341
addr_queue ,
361
342
message_handler = MyMessageHandlerAcceptStreamOffset (),
362
- stream_filter_options = stream_filter_options ,
343
+ stream_filter_options = StreamOptions (
344
+ filters = ["banana" ], filter_match_unfiltered = True
345
+ ),
363
346
)
364
347
# send with annotations filter banana
365
348
publish_messages (connection , messages_to_send , stream_name )
@@ -391,16 +374,15 @@ def test_stream_reconnection(
391
374
392
375
# consume and then publish
393
376
try :
394
- stream_filter_options = StreamOptions ()
395
- stream_filter_options .filter_values (["banana" ])
396
- stream_filter_options .filter_match_unfiltered (True )
397
377
connection_consumer = environment .connection ()
398
378
connection_consumer .dial ()
399
379
consumer = connection_consumer .consumer (
400
380
addr_queue ,
401
381
# disconnection and check happens here
402
382
message_handler = MyMessageHandlerAcceptStreamOffsetReconnect (),
403
- stream_filter_options = stream_filter_options ,
383
+ stream_filter_options = StreamOptions (
384
+ filters = ["banana" ], filter_match_unfiltered = True
385
+ ),
404
386
)
405
387
# send with annotations filter banana
406
388
publish_messages (connection_with_reconnect , messages_to_send , stream_name )
0 commit comments