busline 0.5.0__py3-none-any.whl → 0.5.1__py3-none-any.whl

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.
@@ -4,6 +4,8 @@ from typing import Optional, override, List, Self
4
4
 
5
5
  from busline.client.client import EventBusClient
6
6
  from busline.client.publisher.publisher import Publisher
7
+ from busline.client.subscriber.event_handler.event_handler import EventHandler
8
+ from busline.client.subscriber.topic_subscriber import TopicSubscriber
7
9
  from busline.event.event import Event
8
10
  from busline.client.subscriber.subscriber import Subscriber
9
11
 
@@ -33,7 +35,7 @@ class PubSubClient(EventBusClient):
33
35
  return cls(publishers, subscribers)
34
36
 
35
37
  @classmethod
36
- def from_pubsub_client(cls, client: 'PubSubClient') -> Self:
38
+ def from_pubsub_client(cls, client: Self) -> Self:
37
39
  return cls(client.publishers.copy(), client.subscribers.copy())
38
40
 
39
41
  @override
@@ -89,6 +91,27 @@ class PubSubClient(EventBusClient):
89
91
  ])
90
92
 
91
93
 
94
+ @dataclass
95
+ class PubSubTopicClient(PubSubClient):
96
+ """
97
+ Eventbus client which should used by components which wouldn't be a publisher/subscriber, but they need them
98
+
99
+ Author: Nicola Ricciardi
100
+ """
101
+
102
+ subscribers: List[TopicSubscriber]
103
+
104
+ @override
105
+ async def subscribe(self, topic: str, handler: Optional[EventHandler] = None, **kwargs):
106
+ """
107
+ Subscribe all subscribers on topic
108
+ """
109
+
110
+ await asyncio.gather(*[
111
+ subscriber.subscribe(topic, handler=handler, **kwargs) for subscriber in self.subscribers
112
+ ])
113
+
114
+
92
115
  @dataclass
93
116
  class PubSubClientBuilder:
94
117
  """
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: busline
3
- Version: 0.5.0
3
+ Version: 0.5.1
4
4
  Summary: Agnostic eventbus for Python
5
5
  Author-email: Nicola Ricciardi <ricciardincl@gmail.com>
6
- Project-URL: Homepage, https://github.com/nricciardi/py-busline
7
- Project-URL: Issues, https://github.com/nricciardi/py-busline/issues
6
+ Project-URL: Homepage, https://github.com/orbitalis-framework/py-busline
7
+ Project-URL: Issues, https://github.com/orbitalis-framework/py-busline/issues
8
8
  Classifier: Programming Language :: Python :: 3
9
9
  Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
10
10
  Classifier: Operating System :: OS Independent
@@ -4,7 +4,7 @@ busline/client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  busline/client/client.py,sha256=4IGMJXp_46cPOXJaMeix45rUkxRNlSFJXch2hLy0C70,553
5
5
  busline/client/eventbus_connector.py,sha256=V3D5f4bddlQW1oiZzjvNTsVa0yIHAjYHG03YV3zwz5c,596
6
6
  busline/client/multiclient.py,sha256=QnKK8ShrwbuS1fnsXVhRgMnBzIbPgnDkBPGjswDilR8,1251
7
- busline/client/pubsub_client.py,sha256=QzzJf_Uap9d1Y18PB_rZwU4fNOtSnG3MmFUykxCGt2g,3449
7
+ busline/client/pubsub_client.py,sha256=nkDNhP8M5ULi76YCY35BshuKsvRJH3vsU5ZO5qSmTTA,4161
8
8
  busline/client/publisher/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  busline/client/publisher/publisher.py,sha256=FUht2eeV25lrQzgHxB0OjijEGUiTSan8AEjb-IqYjX8,1521
10
10
  busline/client/subscriber/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -29,8 +29,8 @@ busline/local/publisher/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG
29
29
  busline/local/publisher/local_publisher.py,sha256=FngthjSMZyswYK2Ka1LHrTqFkZ6yvGUjn0COGEzI0hI,1076
30
30
  busline/local/subscriber/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
31
31
  busline/local/subscriber/local_subscriber.py,sha256=tWQ5YCRH78wiFlwO6I_dSAvCyhkQLox0GhoeVPKWxro,1237
32
- busline-0.5.0.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
33
- busline-0.5.0.dist-info/METADATA,sha256=_8Cwu2T1kNnYJK_nV9fVMPScbxnzHB8hPNboQKawSUE,5904
34
- busline-0.5.0.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
35
- busline-0.5.0.dist-info/top_level.txt,sha256=bZY0fK2wgNEI5igR7DBF3CyXHGkzujGvmoqdSzG6Zp0,8
36
- busline-0.5.0.dist-info/RECORD,,
32
+ busline-0.5.1.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
33
+ busline-0.5.1.dist-info/METADATA,sha256=3TUbFdlKE9649gtM2z0b9Ck_vxXMnjQHylagZD4GT90,5922
34
+ busline-0.5.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
35
+ busline-0.5.1.dist-info/top_level.txt,sha256=bZY0fK2wgNEI5igR7DBF3CyXHGkzujGvmoqdSzG6Zp0,8
36
+ busline-0.5.1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.4.0)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5