Skip to content

Commit 92932f6

Browse files
committed
Updated/rewrote toolkit listener implementation.
1 parent 540f6c9 commit 92932f6

File tree

7 files changed

+674
-227
lines changed

7 files changed

+674
-227
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
* Updated and rewrote Notification 2.0 listener implementation. Added additional parameters for more control:
4+
`consumer_name`, `shared`, `auto_ack` and `auto_unsubscribe`. Added `unsubscribe` function for removing
5+
subscribers on demand. Both `AsyncListener` and `Listener` now provide consistent `start`/`stop` functions
6+
which take care of coroutine and thread creation. The `listen ` function can still be invoked directly if
7+
necessary.
8+
39
## Version 3.3.0
410

511
* Added `get_by` function to inventory API to return a single object by query.

c8y_api/model/notification2.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ def __init__(self, c8y: CumulocityRestApi):
280280
super().__init__(c8y, '/notification2')
281281
self.host = urllib.parse.urlparse(c8y.base_url).netloc
282282

283-
def generate(self, subscription: str, expires: int = 60, subscriber: str = None,
283+
def generate(self, subscription: str, expires: int = 1440, subscriber: str = None,
284284
signed: bool = None, shared: bool = None, non_persistent: bool = None) -> str:
285285
"""Generate a new access token.
286286
@@ -303,9 +303,10 @@ def renew(self, token: str) -> str:
303303
"""Renew a token.
304304
305305
Args:
306-
token: Currently valid token to be renewed.
306+
token: Token to be renewed.
307307
"""
308308

309+
309310
def unsubscribe(self, token: str):
310311
"""Invalidate a token and unsubscribe a subscriber.
311312

0 commit comments

Comments
 (0)