Basic event engine
Project description
PyEventEngine
python native event engine
Install
pip install git+https://github.com/BolunHan/PyEventEngine.git
or
pip install PyEventEngine
Use
basic usage
# init event engine
import time
from EventEngine import EventEngine, Topic
EVENT_ENGINE = EventEngine()
EVENT_ENGINE.start()
# register handler
def test_handler(msg, **kwargs):
print(msg)
EVENT_ENGINE.register_handler(topic=Topic('SimpleTopic'), handler=test_handler)
# publish message
EVENT_ENGINE.put(topic=Topic('SimpleTopic'), msg='topic called')
time.sleep(1)
EVENT_ENGINE.stop()
regular topic
# init event engine
import time
from EventEngine import EventEngine, Topic, RegularTopic
EVENT_ENGINE = EventEngine()
EVENT_ENGINE.start()
# register handler
def test_handler(msg, **kwargs):
print(msg)
EVENT_ENGINE.register_handler(topic=RegularTopic('RegularTopic.*'), handler=test_handler)
# publish message
EVENT_ENGINE.put(topic=Topic('RegularTopic.ChildTopic0'), msg='topic called')
time.sleep(1)
EVENT_ENGINE.stop()
See more advanced usage at .Demo
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
PyEventEngine-0.1.1.tar.gz
(7.1 kB
view details)
File details
Details for the file PyEventEngine-0.1.1.tar.gz
.
File metadata
- Download URL: PyEventEngine-0.1.1.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4fa49d7dd51bea8616a4ee99dba6bdbbd937ebeaeba627e30d665d65f5c885fe |
|
MD5 | 9686a805549001ebf63b00be38d767b1 |
|
BLAKE2b-256 | 1497495c3ed633f02136287a753de4f657bc998455a81826f9499608758d3781 |