Add to Dependencies
Addbullmq to your list of dependencies in mix.exs:
Requirements
- Elixir: 1.15 or higher
- Erlang/OTP: 26 or higher
- Redis: 6.0 or higher (7.0+ recommended for best performance)
Dependencies
BullMQ for Elixir includes the following dependencies:- redix (~> 1.3) - Redis client
- nimble_pool (~> 1.0) - Connection pooling
- nimble_options (~> 1.0) - Configuration validation
- jason (~> 1.4) - JSON encoding/decoding
- crontab (~> 1.1) - Cron expression parsing
- msgpax (~> 2.4) - MessagePack encoding for Lua scripts
- elixir_uuid (~> 1.2) - UUID generation
- telemetry (~> 1.2) - Instrumentation and monitoring
Redis Setup
BullMQ requires a Redis server. You can:Run Redis Locally
Use a Managed Redis Service
For production, consider using a managed Redis service:Add Redis Connection to Supervision Tree
Add a Redix connection to your application’s supervision tree:Configuration
You can configure your Redis connection inconfig/config.exs:
Verify Installation
You can verify the installation by running:bullmq in the list of dependencies.
Test Redis Connection
Create a simple test to verify your Redis connection:Common Issues
Redis Connection Errors
If you can’t connect to Redis:- Verify Redis is running:
redis-cli ping(should returnPONG) - Check your host and port configuration
- Ensure your firewall allows connections to the Redis port (default: 6379)
- If using Redis Cloud or other managed services, verify credentials
Compilation Errors
If you encounter compilation errors:- Ensure you’re running Elixir 1.15+ and Erlang/OTP 26+
- Run
mix deps.clean --all && mix deps.get - Try
mix clean && mix compile
Optional: Telemetry Setup
For monitoring and observability, you can set up Telemetry handlers:Next Steps
Usage Guide
Learn how to create queues and workers
