Need for Asynchronous Event-Based Cross-App Communication in Django

Django has an inbuilt signal system, which is useful for decoupling components within an application. However, Django signals are synchronous in nature, meaning they execute within the same request/response cycle, potentially causing performance bottlenecks.

For modern applications, especially those handling real-time data processing, microservices, or event-driven architectures, an asynchronous event-based system for cross-app communication is essential. While third-party libraries like Celery (for task queues) and Django Channels (for WebSockets) exist, Django itself lacks a built-in async event-driven messaging system that works seamlessly across apps.

Would it be beneficial for Django to introduce native support for async signals or an event bus mechanism? Are there any recommended patterns or best practices within Django’s current ecosystem to efficiently handle async cross-app events?

1 Like

Django itself lacks a built-in async event-driven messaging system that works seamlessly across apps.

see django-tasks, which has an accepted DEP

Would it be beneficial for Django to introduce native support for async signals

There already is support for async signal receivers. As with all python async in django, it may be rough around the edges.

event bus mechanism

I haven’t needed this, but if you have an abstraction that you think is nice and you want to share, make a django app and share it!

Adding built in support is probably not super valuable cause project needs can imply preference of a specific infra architecture. You can have a look at FastStream which integrates nicely with Django Django - FastStream.

I’ll also point out here that Channels is not limited for use by WebSocket applications. I use channels as an IPC/Task Manager for parallel operations.