This repository contains the Kafka interface for the MH-MR Architecting tools components. It is recommended to use Docker for the deployment, as this takes care of the setup of the MAT components.
Note
This README documents the Kafka interface only. If you are running the MAT components in a standalone mode and for component-specific information, please see the respective links for the documentation of the FloorPlan DSL and the scenery_builder.
The Kafka interface is a Kafka consumer that listens to the floorplan-model topic, generates the corresponding artefacts, and publishes their path in the server in the scenery-artefacts topic.
As the interface currently doesn't allow to specify which artefacts to generate, we have added support for the following basic artefacts:
| Artefact | Inputs |
|---|---|
| FloorPlan Model (FPM) | |
| Occupancy grid | X |
| 3D Mesh | X |
| Gazebo world/models | X |
Other artefacts supported by the scenery_builder can be added upon request.
At the root of this repository you should create an .env file that contains the login information for Kafka.
This assumes you have a local installation of the FloorPlan DSL and the scenery_builder.
You'll also need to install Confluent Kafka and other requirements:
pip install confluent-kafka requests dotenv
After activating your virtual environment and configuring the interface, simply run the floorplan consumer:
python floorplan_consumer.pyThe floorplan_bim_producer.py and artefact_consumer.py are mockup scripts to test subscribing and publishing to the Kafka topics.
We have included a sample config file to parametrize the generation of artefacts.
Create an .env file to store your credentials and the relevant API endpoints, for example:
KAFKA_USER=myuser
KAFKA_PASS=12345pass
KAFKA_URL=kafka-url:9000
REST_UPLOAD_ARTEFACT_URL=http://server-url:8000/api/upload/artefactAfter building or pulling the Docker image, just run a container.
The default CMD is already set for the Kafka consumer.
You should use the argument --env-file to pass the path of the .env file containing the credentials to login and URLs (see Configuration), for example:
docker run --env-file .env -it mat_kafka:latestThe Dockerfile uses the images of the development branch of the two floorplan components. The images are built as part of the CI and hosted on GitHub.