busline 0.3.0__py3-none-any.whl → 0.3.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.
- {event → busline/event}/event.py +2 -2
- {eventbus → busline/eventbus}/async_local_eventbus.py +2 -2
- {eventbus → busline/eventbus}/eventbus.py +4 -4
- {eventbus → busline/eventbus}/queued_local_eventbus.py +2 -2
- {eventbus_client → busline/eventbus_client}/eventbus_client.py +5 -5
- {eventbus_client → busline/eventbus_client}/local_eventbus_client.py +5 -5
- {eventbus_client → busline/eventbus_client}/publisher/local_eventbus_publisher.py +4 -4
- {eventbus_client → busline/eventbus_client}/publisher/publisher.py +2 -2
- {eventbus_client → busline/eventbus_client}/subscriber/closure_event_listener.py +2 -2
- {eventbus_client → busline/eventbus_client}/subscriber/event_listener.py +1 -1
- {eventbus_client → busline/eventbus_client}/subscriber/local_eventbus_closure_subscriber.py +4 -4
- {eventbus_client → busline/eventbus_client}/subscriber/local_eventbus_subscriber.py +3 -3
- {eventbus_client → busline/eventbus_client}/subscriber/subscriber.py +3 -3
- {busline-0.3.0.dist-info → busline-0.3.1.dist-info}/METADATA +25 -18
- busline-0.3.1.dist-info/RECORD +30 -0
- busline-0.3.1.dist-info/top_level.txt +1 -0
- busline-0.3.0.dist-info/RECORD +0 -30
- busline-0.3.0.dist-info/top_level.txt +0 -4
- /__init__.py → /busline/__init__.py +0 -0
- {event → busline/event}/__init__.py +0 -0
- {event → busline/event}/event_content.py +0 -0
- {event → busline/event}/event_metadata.py +0 -0
- {eventbus → busline/eventbus}/__init__.py +0 -0
- {eventbus → busline/eventbus}/exceptions.py +0 -0
- {eventbus → busline/eventbus}/topic.py +0 -0
- {eventbus_client → busline/eventbus_client}/__init__.py +0 -0
- {eventbus_client → busline/eventbus_client}/eventbus_connector.py +0 -0
- {eventbus_client → busline/eventbus_client}/exceptions.py +0 -0
- {eventbus_client → busline/eventbus_client}/publisher/__init__.py +0 -0
- {eventbus_client → busline/eventbus_client}/subscriber/__init__.py +0 -0
- {busline-0.3.0.dist-info → busline-0.3.1.dist-info}/LICENSE +0 -0
- {busline-0.3.0.dist-info → busline-0.3.1.dist-info}/WHEEL +0 -0
{event → busline/event}/event.py
RENAMED
@@ -1,9 +1,9 @@
|
|
1
1
|
from abc import ABC, abstractmethod
|
2
2
|
from typing import Dict, List
|
3
|
-
from
|
4
|
-
from
|
5
|
-
from
|
6
|
-
from
|
3
|
+
from busline.eventbus.exceptions import TopicNotFound
|
4
|
+
from busline.eventbus_client.subscriber.subscriber import Subscriber
|
5
|
+
from busline.eventbus.topic import Topic
|
6
|
+
from busline.event.event import Event
|
7
7
|
|
8
8
|
|
9
9
|
|
@@ -2,8 +2,8 @@ import asyncio
|
|
2
2
|
import logging
|
3
3
|
from queue import Queue
|
4
4
|
from concurrent.futures import ThreadPoolExecutor
|
5
|
-
from
|
6
|
-
from
|
5
|
+
from busline.event.event import Event
|
6
|
+
from busline.eventbus.eventbus import EventBus
|
7
7
|
|
8
8
|
|
9
9
|
MAX_WORKERS = 3
|
@@ -1,9 +1,9 @@
|
|
1
1
|
from uuid import uuid4
|
2
|
-
from
|
3
|
-
from
|
4
|
-
from
|
5
|
-
from
|
6
|
-
from
|
2
|
+
from busline.event.event import Event
|
3
|
+
from busline.eventbus_client.eventbus_connector import EventBusConnector
|
4
|
+
from busline.eventbus_client.publisher.publisher import Publisher
|
5
|
+
from busline.eventbus_client.subscriber.event_listener import EventListener
|
6
|
+
from busline.eventbus_client.subscriber.subscriber import Subscriber
|
7
7
|
|
8
8
|
|
9
9
|
class EventBusClient(EventBusConnector):
|
@@ -1,11 +1,11 @@
|
|
1
1
|
from typing import Callable
|
2
2
|
from uuid import uuid4
|
3
3
|
|
4
|
-
from
|
5
|
-
from
|
6
|
-
from
|
7
|
-
from
|
8
|
-
from
|
4
|
+
from busline.event.event import Event
|
5
|
+
from busline.eventbus.async_local_eventbus import AsyncLocalEventBus
|
6
|
+
from busline.eventbus_client.eventbus_client import EventBusClient
|
7
|
+
from busline.eventbus_client.publisher.local_eventbus_publisher import LocalEventBusPublisher
|
8
|
+
from busline.eventbus_client.subscriber.local_eventbus_closure_subscriber import LocalEventBusClosureSubscriber
|
9
9
|
|
10
10
|
|
11
11
|
class LocalEventBusClient(EventBusClient):
|
@@ -1,7 +1,7 @@
|
|
1
|
-
from
|
2
|
-
from
|
3
|
-
from
|
4
|
-
from
|
1
|
+
from busline.event.event import Event
|
2
|
+
from busline.eventbus.eventbus import EventBus
|
3
|
+
from busline.eventbus_client.exceptions import EventBusClientNotConnected
|
4
|
+
from busline.eventbus_client.publisher.publisher import Publisher
|
5
5
|
|
6
6
|
|
7
7
|
class LocalEventBusPublisher(Publisher):
|
@@ -2,8 +2,8 @@ import logging
|
|
2
2
|
from abc import ABC, abstractmethod
|
3
3
|
from uuid import uuid4
|
4
4
|
|
5
|
-
from
|
6
|
-
from
|
5
|
+
from busline.event.event import Event
|
6
|
+
from busline.eventbus_client.eventbus_connector import EventBusConnector
|
7
7
|
|
8
8
|
|
9
9
|
class Publisher(EventBusConnector, ABC):
|
@@ -1,6 +1,6 @@
|
|
1
1
|
from typing import Callable
|
2
|
-
from
|
3
|
-
from
|
2
|
+
from busline.event.event import Event
|
3
|
+
from busline.eventbus_client.subscriber.event_listener import EventListener
|
4
4
|
|
5
5
|
|
6
6
|
class ClosureEventListener(EventListener):
|
@@ -1,8 +1,8 @@
|
|
1
1
|
from typing import Callable
|
2
|
-
from
|
3
|
-
from
|
4
|
-
from
|
5
|
-
from
|
2
|
+
from busline.event.event import Event
|
3
|
+
from busline.eventbus.eventbus import EventBus
|
4
|
+
from busline.eventbus_client.subscriber.closure_event_listener import ClosureEventListener
|
5
|
+
from busline.eventbus_client.subscriber.local_eventbus_subscriber import LocalEventBusSubscriber
|
6
6
|
|
7
7
|
|
8
8
|
class LocalEventBusClosureSubscriber(LocalEventBusSubscriber, ClosureEventListener):
|
@@ -1,7 +1,7 @@
|
|
1
1
|
from abc import ABC
|
2
|
-
from
|
3
|
-
from
|
4
|
-
from
|
2
|
+
from busline.eventbus.eventbus import EventBus
|
3
|
+
from busline.eventbus_client.exceptions import EventBusClientNotConnected
|
4
|
+
from busline.eventbus_client.subscriber.subscriber import Subscriber
|
5
5
|
|
6
6
|
|
7
7
|
class LocalEventBusSubscriber(Subscriber, ABC):
|
@@ -1,9 +1,9 @@
|
|
1
1
|
from abc import ABC, abstractmethod
|
2
2
|
from uuid import uuid4
|
3
3
|
|
4
|
-
from
|
5
|
-
from
|
6
|
-
from
|
4
|
+
from busline.event.event import Event
|
5
|
+
from busline.eventbus_client.eventbus_connector import EventBusConnector
|
6
|
+
from busline.eventbus_client.subscriber.event_listener import EventListener
|
7
7
|
|
8
8
|
|
9
9
|
class Subscriber(EventBusConnector, EventListener, ABC):
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: busline
|
3
|
-
Version: 0.3.
|
3
|
+
Version: 0.3.1
|
4
4
|
Summary: Agnostic eventbus for Python
|
5
5
|
Author-email: Nicola Ricciardi <ricciardincl@gmail.com>
|
6
6
|
Project-URL: Homepage, https://github.com/nricciardi/py-busline
|
@@ -23,34 +23,37 @@ Official eventbus library for [Orbitalis](https://github.com/nricciardi/orbitali
|
|
23
23
|
### Using Publisher/Subscriber
|
24
24
|
|
25
25
|
```python
|
26
|
-
from
|
27
|
-
from
|
28
|
-
from
|
29
|
-
from
|
26
|
+
from busline.eventbus.async_local_eventbus import AsyncLocalEventBus
|
27
|
+
from busline.eventbus_client.publisher.local_eventbus_publisher import LocalEventBusPublisher
|
28
|
+
from busline.event.event import Event
|
29
|
+
from busline.eventbus_client.subscriber.local_eventbus_closure_subscriber import LocalEventBusClosureSubscriber
|
30
30
|
|
31
|
+
local_eventbus_instance = AsyncLocalEventBus() # singleton
|
31
32
|
|
32
|
-
local_eventbus_instance = AsyncLocalEventBus() # singleton
|
33
33
|
|
34
34
|
def callback(topic_name: str, event: Event):
|
35
35
|
print(event)
|
36
36
|
|
37
|
+
|
37
38
|
subscriber = LocalEventBusClosureSubscriber(local_eventbus_instance, callback)
|
38
39
|
publisher = LocalEventBusPublisher(local_eventbus_instance)
|
39
40
|
|
40
41
|
await subscriber.subscribe("test-topic")
|
41
42
|
|
42
|
-
await publisher.publish("test-topic", Event())
|
43
|
+
await publisher.publish("test-topic", Event()) # publish empty event
|
43
44
|
```
|
44
45
|
|
45
46
|
### Using EventBusClient
|
46
47
|
|
47
48
|
```python
|
48
|
-
from
|
49
|
-
from
|
49
|
+
from busline.event.event import Event
|
50
|
+
from busline.eventbus_client.local_eventbus_client import LocalEventBusClient
|
51
|
+
|
50
52
|
|
51
53
|
def callback(topic_name: str, event: Event):
|
52
54
|
print(event)
|
53
55
|
|
56
|
+
|
54
57
|
client = LocalEventBusClient(callback)
|
55
58
|
|
56
59
|
await client.subscribe("test")
|
@@ -64,34 +67,38 @@ await client.publish("test", Event())
|
|
64
67
|
Implement business logic of your `Publisher` and `Subscriber` and... done. Nothing more.
|
65
68
|
|
66
69
|
```python
|
67
|
-
from
|
68
|
-
from
|
70
|
+
from busline.event.event import Event
|
71
|
+
from busline.eventbus_client.publisher.publisher import Publisher
|
72
|
+
|
69
73
|
|
70
74
|
class YourEventBusPublisher(Publisher):
|
71
75
|
|
72
76
|
async def _internal_publish(self, topic_name: str, event: Event, **kwargs):
|
73
|
-
pass
|
77
|
+
pass # send events to your eventbus (maybe in cloud?)
|
74
78
|
```
|
75
79
|
|
76
80
|
```python
|
77
|
-
from
|
78
|
-
from
|
81
|
+
from busline.eventbus_client.subscriber.subscriber import Subscriber
|
82
|
+
from busline.event.event import Event
|
83
|
+
|
79
84
|
|
80
85
|
class YourEventBusSubscriber(Subscriber):
|
81
|
-
|
86
|
+
|
82
87
|
async def on_event(self, topic_name: str, event: Event, **kwargs):
|
83
|
-
pass
|
88
|
+
pass # receive your events
|
84
89
|
```
|
85
90
|
|
86
91
|
You could create a client to allow components to use it instead of become a publisher or subscriber.
|
87
92
|
|
88
93
|
```python
|
89
|
-
from
|
90
|
-
from
|
94
|
+
from busline.eventbus_client.eventbus_client import EventBusClient
|
95
|
+
from busline.event.event import Event
|
96
|
+
|
91
97
|
|
92
98
|
def client_callback(topic_name: str, e: Event):
|
93
99
|
print(e)
|
94
100
|
|
101
|
+
|
95
102
|
subscriber = YourEventBusSubscriber(...)
|
96
103
|
publisher = YourEventBusPublisher(...)
|
97
104
|
|
@@ -0,0 +1,30 @@
|
|
1
|
+
busline/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
+
busline/event/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
|
+
busline/event/event.py,sha256=dwO0MD9jw2ENRcW5TJy8aCayudYH-rf1k9WDxYdJanM,595
|
4
|
+
busline/event/event_content.py,sha256=tPvltxfs66yRmUppHvdw5ThYR_K2WitvE5sLybg6vZE,341
|
5
|
+
busline/event/event_metadata.py,sha256=7aaSG4Z9uQzJKRe7Jz8zD6jo6WEo3PORNbJA_RElp8I,556
|
6
|
+
busline/eventbus/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
7
|
+
busline/eventbus/async_local_eventbus.py,sha256=LnuKtq1bha0yr6ucV_m-bBtldcB0iwVkIFmfFwoPU7w,772
|
8
|
+
busline/eventbus/eventbus.py,sha256=Uhcdjcb3EZRYSeV8-I19qFB3CHHR1v8m0BQPkZo0n3Q,2997
|
9
|
+
busline/eventbus/exceptions.py,sha256=sjWa3Eyeqyci2yVWO9jSlnaZggM3SFDbTKzMtdBX1-E,40
|
10
|
+
busline/eventbus/queued_local_eventbus.py,sha256=PMqTE28fHkx1MYgj5VsxdM3jAQVyKW1elzlUTBM0jtw,1376
|
11
|
+
busline/eventbus/topic.py,sha256=rzbdYrv0YLbC6CDoFGhbc8dOVc19OHCQknkTP4fZHh4,950
|
12
|
+
busline/eventbus_client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
13
|
+
busline/eventbus_client/eventbus_client.py,sha256=OqfYgmNkrkXQ4Hjoxji4H4YoqDxHxcrUMqHDKlP1TGc,3099
|
14
|
+
busline/eventbus_client/eventbus_connector.py,sha256=zys73X8ul1UHyJHbIcmXBLucqCQhnLLVj9xDOVc1arU,702
|
15
|
+
busline/eventbus_client/exceptions.py,sha256=gm7oZsXHlymheYDZb209T4FqeZN9Saft0Xklk4rOg54,55
|
16
|
+
busline/eventbus_client/local_eventbus_client.py,sha256=k_Nqafe5McHCKwqnZHe52Fy9UFtSaN_A7CUFdOpjTCg,887
|
17
|
+
busline/eventbus_client/publisher/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
18
|
+
busline/eventbus_client/publisher/local_eventbus_publisher.py,sha256=Gh50GuArq-jLaJMB-uCfUUFQ9PMKz03wY1NY1YIk3s4,1123
|
19
|
+
busline/eventbus_client/publisher/publisher.py,sha256=JtUwIVj0_9SjX3lIzgepVAVrlE0fGqKETnGRGymcxIU,1544
|
20
|
+
busline/eventbus_client/subscriber/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
21
|
+
busline/eventbus_client/subscriber/closure_event_listener.py,sha256=KSU2CyKto_wS-zASZ-5qNa5usCrg-iTj7dpWTHixe90,607
|
22
|
+
busline/eventbus_client/subscriber/event_listener.py,sha256=EeQSkCuhAQNTLigzh2645tNH59tHneEiFzhmrPIzy-k,331
|
23
|
+
busline/eventbus_client/subscriber/local_eventbus_closure_subscriber.py,sha256=LGvUDsiklHritTsblxvWXbyEmwbhDQN7Ze9rAgeVgdc,764
|
24
|
+
busline/eventbus_client/subscriber/local_eventbus_subscriber.py,sha256=EyZqeVNe2WqXEnCoInnqhdADrGi3Zlqw-_umLIiAd74,1343
|
25
|
+
busline/eventbus_client/subscriber/subscriber.py,sha256=AO3PenhPXrXuxp3jsvyr4r4zZh-zYDpkpoXG5Ut0SUs,2258
|
26
|
+
busline-0.3.1.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
27
|
+
busline-0.3.1.dist-info/METADATA,sha256=ezHdhoNgkpGCb2TGedtWYPEh8VF1v6_5DPw_Kirt6uc,2921
|
28
|
+
busline-0.3.1.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
29
|
+
busline-0.3.1.dist-info/top_level.txt,sha256=bZY0fK2wgNEI5igR7DBF3CyXHGkzujGvmoqdSzG6Zp0,8
|
30
|
+
busline-0.3.1.dist-info/RECORD,,
|
@@ -0,0 +1 @@
|
|
1
|
+
busline
|
busline-0.3.0.dist-info/RECORD
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
-
event/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
|
-
event/event.py,sha256=X5HSO6SDoxUFrxMJ9gzll2lr_M5li_09o2we5hMLbUI,587
|
4
|
-
event/event_content.py,sha256=tPvltxfs66yRmUppHvdw5ThYR_K2WitvE5sLybg6vZE,341
|
5
|
-
event/event_metadata.py,sha256=7aaSG4Z9uQzJKRe7Jz8zD6jo6WEo3PORNbJA_RElp8I,556
|
6
|
-
eventbus/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
7
|
-
eventbus/async_local_eventbus.py,sha256=cRAnUPfb22q9CzNS-48aGIdxhEgwg-nGHaAhvaeVIgI,764
|
8
|
-
eventbus/eventbus.py,sha256=INT1DYL_rlyViLTGfEpPisDFp8JUuNJ55ZOuQUjh2E4,2981
|
9
|
-
eventbus/exceptions.py,sha256=sjWa3Eyeqyci2yVWO9jSlnaZggM3SFDbTKzMtdBX1-E,40
|
10
|
-
eventbus/queued_local_eventbus.py,sha256=7Gog7Xy6ytBTkXvUKXsSqXSkarZtiCvGg-qdiQPAQDo,1368
|
11
|
-
eventbus/topic.py,sha256=rzbdYrv0YLbC6CDoFGhbc8dOVc19OHCQknkTP4fZHh4,950
|
12
|
-
eventbus_client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
13
|
-
eventbus_client/eventbus_client.py,sha256=1n53QBf-lvoe_lJhg7gttpOWnl3db9WoKRoJj7z7dBM,3079
|
14
|
-
eventbus_client/eventbus_connector.py,sha256=zys73X8ul1UHyJHbIcmXBLucqCQhnLLVj9xDOVc1arU,702
|
15
|
-
eventbus_client/exceptions.py,sha256=gm7oZsXHlymheYDZb209T4FqeZN9Saft0Xklk4rOg54,55
|
16
|
-
eventbus_client/local_eventbus_client.py,sha256=gep5sO6Oek8y-wQEe-VMlbrboAlUI4QlrNihROY9A5E,867
|
17
|
-
eventbus_client/publisher/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
18
|
-
eventbus_client/publisher/local_eventbus_publisher.py,sha256=fizpHwZGEDuZJHMbBC76jzzcCzbvrp1oIXYKb7KsXi4,1107
|
19
|
-
eventbus_client/publisher/publisher.py,sha256=QzaXlKwlURA4UXUgbkyKwUxaKWbayt5tYNGHy5TtI_Q,1536
|
20
|
-
eventbus_client/subscriber/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
21
|
-
eventbus_client/subscriber/closure_event_listener.py,sha256=1vou3bedIIeuDzdYRJeoEvdNMZtJP_SgnxLboTgFiEg,599
|
22
|
-
eventbus_client/subscriber/event_listener.py,sha256=nBnPA-Jt5_L0qCV-IaTfmr1RTnKe_zMRF3Ce8ciX-4M,327
|
23
|
-
eventbus_client/subscriber/local_eventbus_closure_subscriber.py,sha256=7KPlkMXqwKMBgPhp4U6xkca-oGErdO8ch3W7Ab0XpbI,748
|
24
|
-
eventbus_client/subscriber/local_eventbus_subscriber.py,sha256=f7Vf4IpLeQ2IaMd9kwFUGT7hXrp1AeKHintyQONJ7YE,1331
|
25
|
-
eventbus_client/subscriber/subscriber.py,sha256=MMw_iOVEflBTLiYuEbS--hZ_fOJ3Y82wk6N0BOJXNVA,2246
|
26
|
-
busline-0.3.0.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
27
|
-
busline-0.3.0.dist-info/METADATA,sha256=EzrREZWnK4NQ3ycylqWGSeNPwlRDfaOiijgm_nxiSX8,2891
|
28
|
-
busline-0.3.0.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
29
|
-
busline-0.3.0.dist-info/top_level.txt,sha256=tVHbqJlz1BKM3vq9VKiyjRf2irKCgXPV22iae_fcMss,40
|
30
|
-
busline-0.3.0.dist-info/RECORD,,
|
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
|