# discourse/message_bus

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/discourse-message-bus).**

1,663 stars · 130 forks · Ruby · MIT

## Links

- GitHub: https://github.com/discourse/message_bus
- awesome-repositories: https://awesome-repositories.com/repository/discourse-message-bus.md

## Topics

`rubygem`

## Description

Message Bus is a messaging library for Ruby and Rack applications designed to facilitate real-time data broadcasting and inter-process communication. It provides a framework for pushing live updates to connected clients and synchronizing state across multiple application instances, ensuring consistent data delivery in scaled environments.

The library distinguishes itself through a flexible architecture that supports multiple storage backends, including Redis, PostgreSQL, and in-memory options. It functions as a persistent connection framework that serves as an alternative to traditional web sockets, utilizing a long-polling transport layer to maintain communication channels. Developers can implement granular control over data flow through middleware-based filtering, which allows for the interception and restriction of messages based on content, metadata, or user identity.

Beyond basic messaging, the library includes tools for distributed system coordination, such as propagating cache invalidations and managing message queues. It supports pluggable serialization strategies and data encoding configurations, enabling optimization of transmission speed and payload size for high-volume traffic. The library integrates directly into the Rack request cycle to provide event-driven updates and targeted message distribution via channel-based routing.

## Tags

### Networking & Communication

- [Ruby Message Buses](https://awesome-repositories.com/f/networking-communication/message-bus-interfaces/ruby-message-buses.md) — Provides a messaging library for Ruby and Rack applications to facilitate real-time data broadcasting and inter-process communication.
- [Real-Time State Broadcasting](https://awesome-repositories.com/f/networking-communication/real-time-state-broadcasting.md) — Broadcasts data updates to connected clients across specific channels using persistent connections. ([source](https://github.com/discourse/message_bus/blob/main/README.md))
- [Real-Time Web Communication](https://awesome-repositories.com/f/networking-communication/real-time-web-communication.md) — Enables interactive web applications to push live data updates to clients instantly.
- [Incoming Message Processors](https://awesome-repositories.com/f/networking-communication/incoming-message-processors.md) — Intercepts and discards incoming data packets based on content or metadata rules before application processing. ([source](https://github.com/discourse/message_bus#readme))
- [Channel-Based Routings](https://awesome-repositories.com/f/networking-communication/pub-sub-messaging/sharded-pub-sub/channel-based-routings.md) — Organizes message distribution by mapping publishers and subscribers to specific topics for targeted delivery.

### Data & Databases

- [Distributed Cache Synchronizers](https://awesome-repositories.com/f/data-databases/distributed-state-synchronizers/distributed-cache-synchronizers.md) — Propagates cache invalidations across multiple application instances to maintain consistency in scaled environments. ([source](https://github.com/discourse/message_bus#readme))
- [Server-Pushed Message Streams](https://awesome-repositories.com/f/data-databases/typed-data-collections/sequence-management/asynchronous-streams/multiplexed-message-streams/server-pushed-message-streams.md) — Maintains open communication channels to deliver continuous data updates to clients without repeated polling. ([source](https://github.com/discourse/message_bus#readme))
- [Serialization Strategies](https://awesome-repositories.com/f/data-databases/data-encoding-optimizations/serialization-strategies.md) — Provides pluggable serialization strategies to optimize data transmission speed and payload size for high-volume traffic. ([source](https://github.com/discourse/message_bus/blob/main/README.md))
- [PubSub Interfaces](https://awesome-repositories.com/f/data-databases/redis-clients/pubsub-interfaces.md) — Synchronizes messages and distributed cache updates across processes using Redis pub-sub.
- [Structured Message Serialization](https://awesome-repositories.com/f/data-databases/structured-message-serialization.md) — Supports multiple structured message serialization formats to improve processing speed and reduce bandwidth usage. ([source](https://github.com/discourse/message_bus#readme))

### Security & Cryptography

- [Message Delivery Scoping](https://awesome-repositories.com/f/security-cryptography/domain-access-restrictions/administrative-access-restrictions/identity-based-access-restrictions/message-delivery-scoping.md) — Implements granular control over data flow by restricting message delivery based on user identity and metadata. ([source](https://github.com/discourse/message_bus#readme))

### Software Engineering & Architecture

- [Long-Polling Queries](https://awesome-repositories.com/f/software-engineering-architecture/event-driven-architectures/polling-mechanisms/long-polling-queries.md) — Utilizes a long-polling transport layer to hold HTTP requests open until new data is available.
- [Distributed State Synchronization](https://awesome-repositories.com/f/software-engineering-architecture/distributed-state-synchronization.md) — Propagates cache invalidations and system updates across multiple application instances to maintain consistency.
- [Storage Synchronization](https://awesome-repositories.com/f/software-engineering-architecture/inter-process-communication/storage-synchronization.md) — Synchronizes messages across multiple processes using persistent storage backends to ensure consistent communication. ([source](https://github.com/discourse/message_bus#readme))

### Web Development

- [Real-Time Frameworks](https://awesome-repositories.com/f/web-development/web-applications/real-time-frameworks.md) — Functions as a persistent connection framework alternative to traditional web sockets.
- [Rack-Based Middleware Pipelines](https://awesome-repositories.com/f/web-development/backend-development/middleware-pipelines/rack-based-middleware-pipelines.md) — Integrates directly into the Rack request cycle to facilitate event-driven updates.
- [Path-Based Middleware Filtering](https://awesome-repositories.com/f/web-development/middleware-based-routing/path-based-middleware-filtering.md) — Provides configurable middleware hooks to intercept and filter data packets based on security and content rules.

### Part of an Awesome List

- [Pluggable File and Message Backends](https://awesome-repositories.com/f/awesome-lists/data/storage-and-files/pluggable-file-and-message-backends.md) — Abstracts message storage and synchronization across multiple processes using pluggable drivers like Redis or PostgreSQL.

### Business & Productivity Software

- [Client-Side Message Filtering](https://awesome-repositories.com/f/business-productivity-software/tag-filtering-systems/client-side-message-filtering.md) — Restricts message delivery to end users based on identity or content rules.

### DevOps & Infrastructure

- [Message Queues](https://awesome-repositories.com/f/devops-infrastructure/message-queues.md) — Provides infrastructure for reliable message delivery and persistence between services.

### User Interface & Experience

- [Outgoing Message Filtering](https://awesome-repositories.com/f/user-interface-experience/alerts-notifications/outgoing-message-filtering.md) — Intercepts and drops outgoing data packets based on server-side criteria before transmission to clients. ([source](https://github.com/discourse/message_bus/blob/main/README.md))
