Files
flucto-heisskleber/tests/integration/integration_joint.py
Felix Weiler 78ba98a587 Feature/async sources (#46)
* WIP: Added async file reader.

* Async resampling and synchronization refactored.

* Add async mqtt publisher. Remove queue from joint.

* Add async zmq publisher and subscriber.

* Modify integration tests for streaming.

* Name refactoring resampler.

* Added async source/sink to factory.

* Refactor joint and add integration tests.

* Add termcolor dev dependency

* Add conosole source and sink

* Add cli interface for different protocols

* Removed files unfit for merge.

* Fix review requests.

* Restore use of $MSB_CONFIG_DIR for now.

It seems that the default behaviour is not looking for
.config/heisskleber

* Remove version test, causing unnecessary failures.
2024-01-22 11:23:00 +01:00

28 lines
759 B
Python

import asyncio
from heisskleber.mqtt import AsyncMqttSubscriber, MqttConf
from heisskleber.stream import Joint, Resampler, ResamplerConf
async def main():
topics = ["topic0", "topic1", "topic2", "topic3"]
config = MqttConf(broker="localhost", port=1883, user="", password="") # not a real password
subs = [AsyncMqttSubscriber(config, topic=topic) for topic in topics]
resampler_config = ResamplerConf(resample_rate=1000)
joint = Joint(resampler_config, [Resampler(resampler_config, sub) for sub in subs])
while True:
data = await joint.receive()
print(data)
# Run the event loop
if __name__ == "__main__":
try:
asyncio.run(main())
except KeyboardInterrupt:
print("Keyboard Interrupt")