Skip to content

fix: Switch from Azure Service Bus to RabbitMQ for task queue#620

Merged
dahagag merged 1 commit into
ascoderu:masterfrom
dahagag:fix/switch-to-rabbitmq
Jun 1, 2026
Merged

fix: Switch from Azure Service Bus to RabbitMQ for task queue#620
dahagag merged 1 commit into
ascoderu:masterfrom
dahagag:fix/switch-to-rabbitmq

Conversation

@dahagag

@dahagag dahagag commented Jun 1, 2026

Copy link
Copy Markdown
Member

Problem

Azure Service Bus is incompatible with Kombu 5.x used by Celery 5.3.6, causing production worker failures with:

  • TypeError: isinstance() arg 2 must be a type or tuple of types
  • RuntimeError: can't start new thread

All versions of azure-servicebus 7.x have breaking module structure changes that prevent Kombu from connecting. Exhaustive testing confirmed no combination of azure-servicebus/kombu/celery versions works with Python 3.9.

Solution

Switch from Azure Service Bus to RabbitMQ for the task queue:

  • Remove hardcoded LOKOLE_QUEUE_BROKER_SCHEME=azureservicebus from production compose
  • Add RabbitMQ service (rabbitmq:management-alpine)
  • Add URL encoding for broker credentials to handle special characters (/, =, +)
  • Add rabbitmq_data volume for queue persistence
  • Worker now depends on RabbitMQ service

Production Deployment

Add these two lines to secrets/azure.env on the production server:

LOKOLE_QUEUE_BROKER_SCHEME=amqp
LOKOLE_EMAIL_SERVER_QUEUES_NAMESPACE=rabbitmq

Existing credentials (LOKOLE_EMAIL_SERVER_QUEUES_SAS_NAME and LOKOLE_EMAIL_SERVER_QUEUES_SAS_KEY) will be reused for RabbitMQ authentication.

Testing

✅ Tested locally with RabbitMQ 4.3.1 - worker connects successfully
✅ All 7 queues properly defined as durable (from PR #619)
✅ URL encoding handles special characters in credentials

Related

Azure Service Bus is incompatible with Kombu 5.x used by Celery 5.3.6.
All versions of azure-servicebus 7.x have breaking module structure changes
that prevent Kombu from connecting, causing production worker failures.

Changes:
- Remove hardcoded LOKOLE_QUEUE_BROKER_SCHEME=azureservicebus from docker-compose.prod.yml
- Add RabbitMQ service (rabbitmq:management-alpine) to production compose
- Worker now depends on RabbitMQ service
- Add URL encoding for broker credentials to handle special characters (/, =, +)
- Add rabbitmq_data volume for queue persistence
- Uses existing credentials (LOKOLE_EMAIL_SERVER_QUEUES_SAS_NAME/KEY) for RabbitMQ auth

Production setup:
Add these two lines to secrets/azure.env:
  LOKOLE_QUEUE_BROKER_SCHEME=amqp
  LOKOLE_EMAIL_SERVER_QUEUES_NAMESPACE=rabbitmq

This fixes the production worker failures with TypeError and RuntimeError
when trying to connect to Azure Service Bus.
@dahagag dahagag force-pushed the fix/switch-to-rabbitmq branch from 1a0e0a6 to 7e2c45d Compare June 1, 2026 23:00
@dahagag dahagag merged commit 0563e3c into ascoderu:master Jun 1, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant