Skip to content

Adds support for Redis Sharded Pub/Sub#24

Merged
mayuki merged 2 commits intomainfrom
feature/ShardedPubSub
Jul 29, 2025
Merged

Adds support for Redis Sharded Pub/Sub#24
mayuki merged 2 commits intomainfrom
feature/ShardedPubSub

Conversation

@mayuki
Copy link
Copy Markdown
Member

@mayuki mayuki commented Jul 29, 2025

This PR enables the use of Sharded Pub/Sub by specifying RedisChannelFactory.Sharded in the ChannelFactory property of RedisGroupOptions, as shown in the code below.

services.Configure<RedisGroupOptions>(options =>
{
    options.ChannelFactory = RedisChannelFactory.Sharded;
});

@mayuki mayuki requested a review from Copilot July 29, 2025 02:52
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for Redis Sharded Pub/Sub to the Multicaster library, enabling more efficient message distribution in Redis cluster environments by distributing channels across multiple shards based on key hashing.

  • Introduces a configurable channel factory system allowing selection between default and sharded Redis channels
  • Updates Redis group provider to support the new channel factory mechanism
  • Adds comprehensive test coverage for sharded pub/sub functionality with Redis cluster setup

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/Multicaster.Distributed.Redis/RedisChannelFactory.cs New factory class providing predefined channel creation methods for default and sharded Redis channels
src/Multicaster.Distributed.Redis/RedisGroupOptions.cs Extracted options class with new ChannelFactory property for customizing channel creation
src/Multicaster.Distributed.Redis/RedisGroupProvider.cs Updated to use configurable channel factory and moved options class to separate file
src/Multicaster.Distributed.Redis/RedisGroup.cs Modified constructor to accept channel factory function for flexible channel creation
test/Multicaster.Distributed.Redis.Tests/RedisGroupShardedTest.cs Comprehensive test suite for sharded pub/sub with Redis cluster setup and connectivity verification
test/Multicaster.Distributed.Redis.Tests/RedisGroupTestBase.cs Base class extracting common test utilities for JSON serialization
test/Multicaster.Distributed.Redis.Tests/RedisGroupTest.cs Refactored to inherit from new base class, removing duplicate helper methods
test/Multicaster.Tests/StressTest.cs New stress test for multicast performance validation
Directory.Packages.props Updated StackExchange.Redis to version 2.8.41 for sharded pub/sub support

@mayuki mayuki merged commit 158dbe2 into main Jul 29, 2025
2 checks passed
@mayuki mayuki deleted the feature/ShardedPubSub branch July 29, 2025 03:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants