Skip to content

Commit 66d166d

Browse files
committed
add filters
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
1 parent 11a49ca commit 66d166d

File tree

3 files changed

+3
-9
lines changed

3 files changed

+3
-9
lines changed

examples/getting_started/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def threaded_function(addr_queue):
8282
connection = create_connection()
8383
offset_specification = StreamFilterOptions()
8484
offset_specification.offset(10)
85-
consumer = connection.consumer(addr_queue, handler=MyMessageHandler())
85+
consumer = connection.consumer(addr_queue, handler=MyMessageHandler(), stream_filter_options=offset_specification)
8686
try:
8787
consumer.run()
8888
except KeyboardInterrupt:

rabbitmq_amqp_python_client/entities.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ def __init__(self):
4545
self._filter_set: Dict[symbol, Described] = {}
4646

4747
def offset(self, offset: int):
48-
#self._filter_set[symbol(STREAM_FILTER_SPEC)] = Described(symbol(STREAM_FILTER_SPEC), "first")
49-
print("im here")
5048
self._filter_set[symbol('rabbitmq:stream-offset-spec')] = Described(symbol('rabbitmq:stream-offset-spec'), "first")
5149

5250
def filters(self) -> Dict[symbol, Described]:

rabbitmq_amqp_python_client/options.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from .qpid.proton._data import ( # noqa: E402
22
PropertyDict,
3-
symbol,
3+
symbol, Described,
44
)
55
from .qpid.proton._endpoints import Link # noqa: E402
66
from .qpid.proton.reactor import LinkOption, Filter # noqa: E402
@@ -71,11 +71,7 @@ def __init__(self, addr: str, filter_options: StreamFilterOptions):
7171

7272

7373
def apply(self, link: Link) -> None:
74-
link.target.address = self._addr
75-
link.snd_settle_mode = Link.SND_UNSETTLED
76-
link.rcv_settle_mode = Link.RCV_FIRST
77-
link.properties = PropertyDict({symbol("paired"): True})
78-
link.source.dynamic = False
74+
link.source.filter.put_dict(self.filter_set)
7975

8076
def test(self, link: Link) -> bool:
8177
return bool(link.is_receiver)

0 commit comments

Comments
 (0)