Skip to content

File tree

6 files changed

+33
-28
lines changed

6 files changed

+33
-28
lines changed

sdk/servicebus/azure-servicebus/azure/servicebus/_common/auto_lock_renewer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ def register(
259259
:param renewable: A locked entity that needs to be renewed.
260260
:type renewable: Union[~azure.servicebus.ServiceBusReceivedMessage, ~azure.servicebus.ServiceBusSession]
261261
:param max_lock_renewal_duration: A time in seconds that the lock should be maintained for.
262-
Default value is 300 (5 minutes).
262+
Default value is None. If specified, this value will override the default value specified at the constructor.
263263
:type max_lock_renewal_duration: Optional[float]
264264
:param on_lock_renew_failure: A callback may be specified to be called when the lock is lost on the renewable
265265
that is being registered. Default value is None (no callback).

sdk/servicebus/azure-servicebus/azure/servicebus/_common/message.py

+12-2
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,14 @@
5858
)
5959
from .._servicebus_receiver import ServiceBusReceiver
6060
from azure.core.tracing import AbstractSpan
61+
PrimitiveTypes = Union[
62+
int,
63+
float,
64+
bytes,
65+
bool,
66+
str,
67+
uuid.UUID
68+
]
6169

6270
_LOGGER = logging.getLogger(__name__)
6371

@@ -70,7 +78,9 @@ class ServiceBusMessage(
7078
:param body: The data to send in a single message.
7179
:type body: Optional[Union[str, bytes]]
7280
73-
:keyword Optional[Dict] application_properties: The user defined properties on the message.
81+
:keyword application_properties: The user defined properties on the message.
82+
:paramtype application_properties: Dict[str, Union[int or float or bool or
83+
bytes or str or uuid.UUID or datetime or None]]
7484
:keyword Optional[str] session_id: The session identifier of the message for a sessionful entity.
7585
:keyword Optional[str] message_id: The id to identify the message.
7686
:keyword Optional[datetime.datetime] scheduled_enqueue_time_utc: The utc scheduled enqueue time to the message.
@@ -98,7 +108,7 @@ def __init__(
98108
self,
99109
body: Optional[Union[str, bytes]],
100110
*,
101-
application_properties: Optional[Dict[str, Any]] = None,
111+
application_properties: Optional[Dict[str, "PrimitiveTypes"]] = None,
102112
session_id: Optional[str] = None,
103113
message_id: Optional[str] = None,
104114
scheduled_enqueue_time_utc: Optional[datetime.datetime] = None,

sdk/servicebus/azure-servicebus/azure/servicebus/_servicebus_client.py

+7-9
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ class ServiceBusClient(object):
7373
:keyword float retry_backoff_factor: Delta back-off internal in the unit of second between retries.
7474
Default value is 0.8.
7575
:keyword float retry_backoff_max: Maximum back-off interval in the unit of second. Default value is 120.
76-
:keyword retry_mode: The delay behavior between retry attempts. Supported values are 'fixed' or 'exponential',
77-
where default is 'exponential'.
76+
:keyword retry_mode: The delay behavior between retry attempts. Supported values are "fixed" or "exponential",
77+
where default is "exponential".
7878
:paramtype retry_mode: str
7979
8080
.. admonition:: Example:
@@ -97,7 +97,7 @@ def __init__(
9797
*,
9898
retry_total: int = 3,
9999
retry_backoff_factor: float = 0.8,
100-
retry_backoff_max: int = 120,
100+
retry_backoff_max: float = 120,
101101
retry_mode: str = "exponential",
102102
**kwargs: Any
103103
) -> None:
@@ -290,13 +290,12 @@ def get_queue_receiver(
290290
sessionful queue, otherwise it must be None. In order to receive messages from the next available
291291
session, set this to ~azure.servicebus.NEXT_AVAILABLE_SESSION.
292292
:paramtype session_id: str or ~azure.servicebus.NEXT_AVAILABLE_SESSION
293-
:keyword sub_queue: If specified, the subqueue this receiver will
294-
connect to.
293+
:keyword sub_queue: If specified, the subqueue this receiver will connect to.
295294
This includes the DEAD_LETTER and TRANSFER_DEAD_LETTER queues, holds messages that can't be delivered to any
296295
receiver or messages that can't be processed.
297296
The default is None, meaning connect to the primary queue. Can be assigned values from `ServiceBusSubQueue`
298297
enum or equivalent string values "deadletter" and "transferdeadletter".
299-
:paramtype sub_queue: str or ~azure.servicebus.ServiceBusSubQueue
298+
:paramtype sub_queue: str or ~azure.servicebus.ServiceBusSubQueue or None
300299
:keyword receive_mode: The receive_mode with which messages will be retrieved from the entity. The two options
301300
are PEEK_LOCK and RECEIVE_AND_DELETE. Messages received with PEEK_LOCK must be settled within a given
302301
lock period before they will be removed from the queue. Messages received with RECEIVE_AND_DELETE
@@ -445,13 +444,12 @@ def get_subscription_receiver(
445444
sessionful subscription, otherwise it must be None. In order to receive messages from the next available
446445
session, set this to ~azure.servicebus.NEXT_AVAILABLE_SESSION.
447446
:paramtype session_id: str or ~azure.servicebus.NEXT_AVAILABLE_SESSION
448-
:keyword sub_queue: If specified, the subqueue this receiver will
449-
connect to.
447+
:keyword sub_queue: If specified, the subqueue this receiver will connect to.
450448
This includes the DEAD_LETTER and TRANSFER_DEAD_LETTER queues, holds messages that can't be delivered to any
451449
receiver or messages that can't be processed.
452450
The default is None, meaning connect to the primary queue. Can be assigned values from `ServiceBusSubQueue`
453451
enum or equivalent string values "deadletter" and "transferdeadletter".
454-
:paramtype sub_queue: str or ~azure.servicebus.ServiceBusSubQueue
452+
:paramtype sub_queue: str or ~azure.servicebus.ServiceBusSubQueue or None
455453
:keyword receive_mode: The receive_mode with which messages will be retrieved from the entity. The two options
456454
are PEEK_LOCK and RECEIVE_AND_DELETE. Messages received with PEEK_LOCK must be settled within a given
457455
lock period before they will be removed from the subscription. Messages received with RECEIVE_AND_DELETE

sdk/servicebus/azure-servicebus/azure/servicebus/_servicebus_session.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@
3030

3131

3232
class BaseSession(object):
33-
def __init__(self, session_id, receiver):
34-
# type: (str, Union[ServiceBusReceiver, ServiceBusReceiverAsync]) -> None
33+
def __init__(self, session_id: str, receiver: Union["ServiceBusReceiver", "ServiceBusReceiverAsync"]) -> None:
3534
self._session_id = session_id
3635
self._receiver = receiver
3736
self._encoding = "UTF-8"

sdk/servicebus/azure-servicebus/azure/servicebus/aio/_async_auto_lock_renewer.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,8 @@ def register(
175175
:type receiver: ~azure.servicebus.aio.ServiceBusReceiver
176176
:param renewable: A locked entity that needs to be renewed.
177177
:type renewable: Union[~azure.servicebus.aio.ServiceBusReceivedMessage,~azure.servicebus.aio.ServiceBusSession]
178-
:param max_lock_renewal_duration: A time in seconds that locks registered to this renewer
179-
should be maintained for. Default value is 300 (5 minutes).
178+
:param max_lock_renewal_duration: A time in seconds that the lock should be maintained for.
179+
Default value is None. If specified, this value will override the default value specified at the constructor.
180180
:type max_lock_renewal_duration: Optional[float]
181181
:param Optional[AsyncLockRenewFailureCallback] on_lock_renew_failure:
182182
An async callback may be specified to be called when the lock is lost on the renewable being registered.

sdk/servicebus/azure-servicebus/azure/servicebus/aio/_servicebus_client_async.py

+10-12
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ class ServiceBusClient(object):
6666
:keyword float retry_backoff_factor: Delta back-off internal in the unit of second between retries.
6767
Default value is 0.8.
6868
:keyword float retry_backoff_max: Maximum back-off interval in the unit of second. Default value is 120.
69-
:keyword retry_mode: The delay behavior between retry attempts. Supported values are 'fixed' or 'exponential',
70-
where default is 'exponential'.
69+
:keyword retry_mode: The delay behavior between retry attempts. Supported values are "fixed" or "exponential",
70+
where default is "exponential".
7171
:paramtype retry_mode: str
7272
7373
.. admonition:: Example:
@@ -90,8 +90,8 @@ def __init__(
9090
*,
9191
retry_total: int = 3,
9292
retry_backoff_factor: float = 0.8,
93-
retry_backoff_max: int = 120,
94-
retry_mode: str = 'exponential',
93+
retry_backoff_max: float = 120,
94+
retry_mode: str = "exponential",
9595
**kwargs: Any
9696
) -> None:
9797
# If the user provided http:// or sb://, let's be polite and strip that.
@@ -278,14 +278,13 @@ def get_queue_receiver(
278278
:keyword session_id: A specific session from which to receive. This must be specified for a
279279
sessionful queue, otherwise it must be None. In order to receive messages from the next available
280280
session, set this to ~azure.servicebus.NEXT_AVAILABLE_SESSION.
281-
:paramtype session_id: str or ~azure.servicebus.NEXT_AVAILABLE_SESSION
282-
:keyword sub_queue: If specified, the subqueue this receiver will
283-
connect to.
281+
:paramtype session_id: str or ~azure.servicebus.NEXT_AVAILABLE_SESSION or None
282+
:keyword sub_queue: If specified, the subqueue this receiver will connect to.
284283
This includes the DEAD_LETTER and TRANSFER_DEAD_LETTER queues, holds messages that can't be delivered to any
285284
receiver or messages that can't be processed.
286285
The default is None, meaning connect to the primary queue. Can be assigned values from `ServiceBusSubQueue`
287286
enum or equivalent string values "deadletter" and "transferdeadletter".
288-
:paramtype sub_queue: str or ~azure.servicebus.ServiceBusSubQueue
287+
:paramtype sub_queue: str or ~azure.servicebus.ServiceBusSubQueue or None
289288
:keyword receive_mode: The mode with which messages will be retrieved from the entity. The two options
290289
are PEEK_LOCK and RECEIVE_AND_DELETE. Messages received with PEEK_LOCK must be settled within a given
291290
lock period before they will be removed from the queue. Messages received with RECEIVE_AND_DELETE
@@ -431,14 +430,13 @@ def get_subscription_receiver(
431430
:keyword session_id: A specific session from which to receive. This must be specified for a
432431
sessionful subscription, otherwise it must be None. In order to receive messages from the next available
433432
session, set this to ~azure.servicebus.NEXT_AVAILABLE_SESSION.
434-
:paramtype session_id: str or ~azure.servicebus.NEXT_AVAILABLE_SESSION
435-
:keyword sub_queue: If specified, the subqueue this receiver will
436-
connect to.
433+
:paramtype session_id: str or ~azure.servicebus.NEXT_AVAILABLE_SESSION or None
434+
:keyword sub_queue: If specified, the subqueue this receiver will connect to.
437435
This includes the DEAD_LETTER and TRANSFER_DEAD_LETTER queues, holds messages that can't be delivered to any
438436
receiver or messages that can't be processed.
439437
The default is None, meaning connect to the primary queue. Can be assigned values from `ServiceBusSubQueue`
440438
enum or equivalent string values "deadletter" and "transferdeadletter".
441-
:paramtype sub_queue: str or ~azure.servicebus.ServiceBusSubQueue
439+
:paramtype sub_queue: str or ~azure.servicebus.ServiceBusSubQueue or None
442440
:keyword receive_mode: The mode with which messages will be retrieved from the entity. The two options
443441
are PEEK_LOCK and RECEIVE_AND_DELETE. Messages received with PEEK_LOCK must be settled within a given
444442
lock period before they will be removed from the subscription. Messages received with RECEIVE_AND_DELETE

0 commit comments

Comments
 (0)