Пример #1
0
 private void HandleShardRegionQuery(IShardRegionQuery query)
 {
     if (query is GetCurrentRegions)
     {
         if (_coordinator != null)
         {
             _coordinator.Forward(query);
         }
         else
         {
             Sender.Tell(new CurrentRegions(new Address[0]));
         }
     }
     else if (query is GetShardRegionState)
     {
         ReplyToRegionStateQuery(Sender);
     }
     else if (query is GetShardRegionStats)
     {
         ReplyToRegionStatsQuery(Sender);
     }
     else if (query is GetClusterShardingStats)
     {
         if (_coordinator != null)
         {
             _coordinator.Tell(new ClusterShardingStats(new Dictionary <Address, ShardRegionStats>(0)));
         }
     }
     else
     {
         Unhandled(query);
     }
 }
Пример #2
0
        private void HandleShardRegionQuery(IShardRegionQuery query)
        {
            switch (query)
            {
            case GetCurrentRegions _:
                if (_coordinator != null)
                {
                    _coordinator.Forward(query);
                }
                else
                {
                    Sender.Tell(new CurrentRegions(ImmutableHashSet <Address> .Empty));
                }
                break;

            case GetShardRegionState _:
                ReplyToRegionStateQuery(Sender);
                break;

            case GetShardRegionStats _:
                ReplyToRegionStatsQuery(Sender);
                break;

            case GetClusterShardingStats _:
                if (_coordinator != null)
                {
                    _coordinator.Forward(query);
                }
                else
                {
                    Sender.Tell(new ClusterShardingStats(ImmutableDictionary <Address, ShardRegionStats> .Empty));
                }
                break;

            default:
                Unhandled(query);
                break;
            }
        }