Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/compas-dev/compas_eve
COMPAS Event Extensions: adds event-based communication infrastructure to the COMPAS framework.
https://github.com/compas-dev/compas_eve
architecture compas event-bus events mqtt
Last synced: about 2 months ago
JSON representation
COMPAS Event Extensions: adds event-based communication infrastructure to the COMPAS framework.
- Host: GitHub
- URL: https://github.com/compas-dev/compas_eve
- Owner: compas-dev
- License: mit
- Created: 2023-07-09T14:41:36.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-05-27T18:02:38.000Z (8 months ago)
- Last Synced: 2024-10-05T20:04:11.520Z (3 months ago)
- Topics: architecture, compas, event-bus, events, mqtt
- Language: Python
- Homepage: http://compas.dev/compas_eve/
- Size: 17.8 MB
- Stars: 3
- Watchers: 12
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Authors: AUTHORS.md
Awesome Lists containing this project
README
# COMPAS EVE
Event-based communication for the COMPAS framework.
```python
>>> import compas_eve as eve
>>> pub = eve.Publisher("/hello_world")
>>> sub = eve.EchoSubscriber("/hello_world")
>>> sub.subscribe()
>>> for i in range(10):
... pub.publish(dict(text=f"Hello World {i}"))
```It is extremely easy to send messages around. COMPAS EVE supports
different transport mechanisms to send messages between different threads, processes, computers, etc.## Installation
Install using `pip`:
```bash
pip install compas_eve
```Or using `conda`:
```bash
conda install compas_eve
```## Supported features
* Publisher/subscriber communication model (N-to-N communication)
* In-process events
* MQTT support
* CPython & IronPython support## Examples
### In-process events
The simplest option is to use in-process events. This works for
simple applications and allows to communicate between threads.```python
import compas_eve as evepub = eve.Publisher("/hello_world")
sub = eve.EchoSubscriber("/hello_world")
sub.subscribe()for i in range(10):
pub.publish(dict(text=f"Hello World {i}"))
```### MQTT
MQTT is a protocol that allows to send messages between different
systems/computers. Using MQTT is very simple as well:```python
import compas_eve as eve
from compas_eve.mqtt import MqttTransporttx = MqttTransport("broker.hivemq.com")
eve.set_default_transport(tx)pub = eve.Publisher("/hello_world")
sub = eve.EchoSubscriber("/hello_world")
sub.subscribe()for i in range(10):
pub.publish(dict(text=f"Hello World {i}"))
```This example shows how to send and receive from a single script, but
running publishers and subscribers on different scripts, different processes, or even different computers will work the exact same way.### Usage from Rhinoceros 3D
It is possible to use the same code from within Rhino/Grasshopper.
Make sure you have installed it to Rhino using the COMPAS installation mechanism:
```bash
python -m compas_rhino.install -v 7.0
```