@@ -76,6 +76,7 @@ def __init__(
7676 topic : str ,
7777 publish : Callable [[OutgoingMessage [ROSMessageT ], int | None , str ], None ] | None ,
7878 node_handle : Node ,
79+ qos_depth : int = 10 ,
7980 ) -> None :
8081 """
8182 Create a subscription.
@@ -92,6 +93,7 @@ def __init__(
9293 self .topic = topic
9394 self .publish = publish
9495 self .node_handle = node_handle
96+ self .subscriber_qos_depth = qos_depth
9597
9698 self .clients = {}
9799
@@ -156,6 +158,7 @@ def subscribe(
156158 self .node_handle ,
157159 msg_type = msg_type ,
158160 raw = raw ,
161+ qos_depth = self .subscriber_qos_depth ,
159162 )
160163
161164 def unsubscribe (self , sid : str | None = None ) -> None :
@@ -248,9 +251,10 @@ class Subscribe(Capability):
248251 )
249252 unsubscribe_msg_fields = ((True , "topic" , str ),)
250253
251- parameter_names = ("topics_glob" ,)
254+ parameter_names = ("topics_glob" , "subscriber_qos_depth" )
252255
253256 topics_glob : list [str ] | None = None
257+ subscriber_qos_depth : int = 10
254258
255259 def __init__ (self , protocol : Protocol ) -> None :
256260 # Call superclass constructor
@@ -296,7 +300,7 @@ def subscribe(self, msg: dict[str, Any]) -> None:
296300 client_id = self .protocol .client_id
297301 cb = partial (self .publish , topic )
298302 self ._subscriptions [topic ] = Subscription (
299- client_id , topic , cb , self .protocol .node_handle
303+ client_id , topic , cb , self .protocol .node_handle , qos_depth = self . subscriber_qos_depth
300304 )
301305
302306 # Register the subscriber
0 commit comments