Component Libraries •
Project Templates
Docs •
Install •
Tutorials •
Developer Guides •
Contribute •
Blog •
Discord
Xircuits Component Library to interface with RabbitMQ! Build robust messaging and queuing workflows.
This library enables Xircuits to integrate with RabbitMQ for building messaging-based workflows. It provides components to connect, publish, consume, and manage messages in RabbitMQ queues efficiently.
Before you begin, you will need the following:
- Python3.9+.
- Xircuits.
- RabbitMQ
Connects to a RabbitMQ broker with optional credentials (username, password). Initializes the RabbitMQ client and channel for message operations.
Publishes a message to a specified queue, exchange, or routing key. If the queue does not exist, it is created automatically.
Consumes messages from a queue and triggers a connected component (on_message
) for processing. Acknowledges messages automatically after processing.
We have provided an example workflow to help you get started with the RabbitMQ component library. Give it a try and see how you can create custom RabbitMQ components for your applications.
This example demonstrates how to connect to a RabbitMQ server, consume messages from a queue, modify them by appending extra text, and publish the modified messages to another queue. It also prints the processed messages for verification.
To use this component library, ensure that you have an existing Xircuits setup. You can then install the RabbitMQ library using the component library interface, or through the CLI using:
xircuits install rabbitmq
You can also do it manually by cloning and installing it:
# base Xircuits directory
git clone https://github.com/XpressAI/xai-rabbitmq xai_components/xai_rabbitmq
pip install -r xai_components/xai_rabbitmq/requirements.txt
To set up RabbitMQ locally for testing:
-
Install RabbitMQ:
- On Ubuntu/Debian:
sudo apt update && sudo apt install rabbitmq-server -y
- On Windows: Download and install RabbitMQ and Erlang from the official RabbitMQ website.
- On Ubuntu/Debian:
-
Start RabbitMQ:
- On Linux:
sudo systemctl start rabbitmq-server sudo systemctl enable rabbitmq-server # Optional: Auto-start on boot
- On Windows: Start RabbitMQ as a service via
services.msc
or the command prompt.
- On Linux:
-
Access RabbitMQ:
- Open the RabbitMQ Management UI at http://localhost:15672.
- Default login:
- Username:
guest
- Password:
guest
- Username:
-
Run the Xircuits Example:
- Create the
testing
andtesting_reply
queues in RabbitMQ. - Execute the Xircuits example to consume and process messages.
- Create the