File tree Expand file tree Collapse file tree 3 files changed +20
-5
lines changed
rabbitmq_amqp_python_client Expand file tree Collapse file tree 3 files changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ def main() -> None:
7070 exchange_name = "test-exchange"
7171 queue_name = "example-queue"
7272 routing_key = "routing-key"
73- messages_to_publish = 100
73+ messages_to_publish = 100000
7474
7575 print ("connection to amqp server" )
7676 connection = create_connection ()
@@ -112,9 +112,9 @@ def main() -> None:
112112 status = publisher .publish (Message (body = "test" ))
113113 if status .ACCEPTED :
114114 print ("message accepted" )
115- if status .RELEASED :
115+ elif status .RELEASED :
116116 print ("message not routed" )
117- if status .REJECTED :
117+ elif status .REJECTED :
118118 print ("message not rejected" )
119119
120120 publisher .close ()
Original file line number Diff line number Diff line change @@ -21,6 +21,21 @@ def test(self, link: Link) -> bool:
2121 return bool (link .is_sender )
2222
2323
24+ class SenderOptionUnseattle (LinkOption ): # type: ignore
25+ def __init__ (self , addr : str ):
26+ self ._addr = addr
27+
28+ def apply (self , link : Link ) -> None :
29+ link .source .address = self ._addr
30+ link .snd_settle_mode = Link .SND_UNSETTLED
31+ link .rcv_settle_mode = Link .RCV_FIRST
32+ link .properties = PropertyDict ({symbol ("paired" ): True })
33+ link .source .dynamic = False
34+
35+ def test (self , link : Link ) -> bool :
36+ return bool (link .is_sender )
37+
38+
2439class ReceiverOption (LinkOption ): # type: ignore
2540 def __init__ (self , addr : str ):
2641 self ._addr = addr
Original file line number Diff line number Diff line change 11import logging
22from typing import Optional
33
4- from .options import SenderOption
4+ from .options import SenderOptionUnseattle
55from .qpid .proton ._delivery import Delivery
66from .qpid .proton ._message import Message
77from .qpid .proton .utils import (
@@ -34,4 +34,4 @@ def close(self) -> None:
3434 self ._sender .close ()
3535
3636 def _create_sender (self , addr : str ) -> BlockingSender :
37- return self ._conn .create_sender (addr , options = SenderOption (addr ))
37+ return self ._conn .create_sender (addr , options = SenderOptionUnseattle (addr ))
You can’t perform that action at this time.
0 commit comments