pyqttier 0.2.2__tar.gz → 0.2.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyqttier-0.2.2 → pyqttier-0.2.4}/PKG-INFO +1 -1
- {pyqttier-0.2.2 → pyqttier-0.2.4}/pyproject.toml +1 -1
- {pyqttier-0.2.2 → pyqttier-0.2.4}/src/pyqttier/connection.py +10 -8
- {pyqttier-0.2.2 → pyqttier-0.2.4}/src/pyqttier/message.py +4 -3
- {pyqttier-0.2.2 → pyqttier-0.2.4}/src/pyqttier/mock.py +2 -2
- {pyqttier-0.2.2 → pyqttier-0.2.4}/uv.lock +1 -1
- {pyqttier-0.2.2 → pyqttier-0.2.4}/.github/workflows/python-tests.yml +0 -0
- {pyqttier-0.2.2 → pyqttier-0.2.4}/.github/workflows/python37.yml +0 -0
- {pyqttier-0.2.2 → pyqttier-0.2.4}/.gitignore +0 -0
- {pyqttier-0.2.2 → pyqttier-0.2.4}/LICENSE +0 -0
- {pyqttier-0.2.2 → pyqttier-0.2.4}/README.md +0 -0
- {pyqttier-0.2.2 → pyqttier-0.2.4}/examples/README.md +0 -0
- {pyqttier-0.2.2 → pyqttier-0.2.4}/examples/mock_example.py +0 -0
- {pyqttier-0.2.2 → pyqttier-0.2.4}/examples/usage_example.py +0 -0
- {pyqttier-0.2.2 → pyqttier-0.2.4}/src/pyqttier/__init__.py +0 -0
- {pyqttier-0.2.2 → pyqttier-0.2.4}/src/pyqttier/interface.py +0 -0
- {pyqttier-0.2.2 → pyqttier-0.2.4}/src/pyqttier/lwt.py +0 -0
- {pyqttier-0.2.2 → pyqttier-0.2.4}/src/pyqttier/py.typed +0 -0
- {pyqttier-0.2.2 → pyqttier-0.2.4}/src/pyqttier/transport.py +0 -0
- {pyqttier-0.2.2 → pyqttier-0.2.4}/tests/__init__.py +0 -0
- {pyqttier-0.2.2 → pyqttier-0.2.4}/tests/test_pyqttier.py +0 -0
|
@@ -110,14 +110,16 @@ class Mqtt5Connection(IBrokerConnection):
|
|
|
110
110
|
def _on_message(self, client, userdata, msg):
|
|
111
111
|
self._logger.debug("Got a message to %s : %s", msg.topic, msg.payload.decode())
|
|
112
112
|
message = Message.from_paho_message(msg)
|
|
113
|
-
if message.
|
|
114
|
-
sub_id
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
113
|
+
if len(message.subscription_ids) > 0:
|
|
114
|
+
for sub_id in message.subscription_ids:
|
|
115
|
+
with self._message_handling_lock:
|
|
116
|
+
if sub_id in self._subscription_callbacks:
|
|
117
|
+
self._subscription_callbacks[sub_id](message)
|
|
118
|
+
return
|
|
119
|
+
else:
|
|
120
|
+
self._logger.debug("No specific callback for subscription ID %d", sub_id)
|
|
121
|
+
else:
|
|
122
|
+
self._logger.debug("No matching subscription ID callbacks found for message.")
|
|
121
123
|
else:
|
|
122
124
|
self._logger.warning("No subscription ID found in message properties. This is not usual because we always provide one when subscribing.")
|
|
123
125
|
with self._message_handling_lock:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from dataclasses import dataclass, field
|
|
2
|
-
from typing import Optional, Dict, Any
|
|
2
|
+
from typing import Optional, Dict, Any, List
|
|
3
3
|
from paho.mqtt.client import MQTTMessage
|
|
4
4
|
from paho.mqtt.properties import Properties as MqttProperties
|
|
5
5
|
from paho.mqtt.packettypes import PacketTypes
|
|
@@ -13,7 +13,7 @@ class Message:
|
|
|
13
13
|
content_type: Optional[str] = None
|
|
14
14
|
correlation_data: Optional[bytes] = None
|
|
15
15
|
response_topic: Optional[str] = None
|
|
16
|
-
|
|
16
|
+
subscription_ids: List[int] = field(default_factory=list) # Ignored on publish
|
|
17
17
|
message_expiry_interval: Optional[int] = None
|
|
18
18
|
user_properties: Optional[Dict[str, str]] = field(default_factory=dict)
|
|
19
19
|
|
|
@@ -64,5 +64,6 @@ class Message:
|
|
|
64
64
|
if "MessageExpiryInterval" in properties:
|
|
65
65
|
msg_obj.message_expiry_interval = properties["MessageExpiryInterval"]
|
|
66
66
|
if "SubscriptionIdentifier" in properties:
|
|
67
|
-
|
|
67
|
+
sub_ids = properties["SubscriptionIdentifier"] if isinstance(properties["SubscriptionIdentifier"], list) else [properties["SubscriptionIdentifier"]]
|
|
68
|
+
msg_obj.subscription_ids = sub_ids
|
|
68
69
|
return msg_obj
|
|
@@ -74,7 +74,7 @@ class MockConnection(IBrokerConnection):
|
|
|
74
74
|
if self.is_topic_sub(message.topic, topic_filter):
|
|
75
75
|
if callback is not None:
|
|
76
76
|
receiving_msg = copy(message)
|
|
77
|
-
receiving_msg.
|
|
77
|
+
receiving_msg.subscription_ids = [sub_id]
|
|
78
78
|
callback(receiving_msg)
|
|
79
79
|
return
|
|
80
80
|
|
|
@@ -95,7 +95,7 @@ class MockConnection(IBrokerConnection):
|
|
|
95
95
|
future.set_result(None)
|
|
96
96
|
return future
|
|
97
97
|
|
|
98
|
-
def subscribe(self, topic: str, callback: Optional[MessageCallback] = None) -> int:
|
|
98
|
+
def subscribe(self, topic: str, callback: Optional[MessageCallback] = None, qos: int = 1) -> int:
|
|
99
99
|
"""
|
|
100
100
|
Registers a subscription and returns a subscription ID.
|
|
101
101
|
"""
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|