/// <summary>
        /// Initializes a new instance of the <see cref="ClusterClusterEvents"/> class.
        /// </summary>
        /// <param name="clusterState">The cluster state.</param>
        /// <param name="clusterMembers">The cluster members.</param>
        /// <param name="clusterEvents">The cluster events.</param>
        public ClusterClusterEvents(ClusterState clusterState, ClusterMembers clusterMembers, ClusterEvents clusterEvents)
        {
            _clusterState = clusterState;

            _objectLifecycleEventSubscription = new ObjectLifecycleEventSubscription(_clusterState, clusterEvents)
            {
                ObjectCreated   = args => _objectCreated.AwaitEach(args),
                ObjectDestroyed = args => _objectDestroyed.AwaitEach(args)
            };

            _partitionLostEventSubscription = new PartitionLostEventSubscription(_clusterState, clusterEvents, clusterMembers)
            {
                PartitionLost = args => _partitionLost.AwaitEach(args)
            };
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ClusterClusterEvents"/> class.
        /// </summary>
        /// <param name="clusterState">The cluster state.</param>
        /// <param name="clusterMembers">The cluster members.</param>
        /// <param name="clusterEvents">The cluster events.</param>
        public ClusterClusterEvents(ClusterState clusterState, ClusterMembers clusterMembers, ClusterEvents clusterEvents)
        {
            _clusterState  = clusterState;
            _clusterEvents = clusterEvents;

            _objectLifecycleEventSubscription = new ObjectLifecycleEventSubscription(_clusterState, clusterEvents)
            {
                Handle = (eventType, args) => _onObjectLifeCycleEvent(eventType, args)
            };

            _partitionLostEventSubscription = new PartitionLostEventSubscription(_clusterState, clusterEvents, clusterMembers)
            {
                Handle = args => _onPartitionLost(args)
            };
        }
Пример #3
0
        public ClusterEvents(ClusterState clusterState, ClusterMessaging clusterMessaging, TerminateConnections terminateConnections, ClusterMembers clusterMembers)
        {
            _clusterState     = clusterState;
            _clusterMessaging = clusterMessaging;
            _clusterMembers   = clusterMembers;

            _logger               = _clusterState.LoggerFactory.CreateLogger <ClusterEvents>();
            _scheduler            = new DistributedEventScheduler(_clusterState.LoggerFactory);
            _terminateConnections = terminateConnections;

            _objectLifecycleEventSubscription = new ObjectLifecycleEventSubscription(_clusterState, this)
            {
                ObjectCreated   = args => _objectCreated.AwaitEach(args),
                ObjectDestroyed = args => _objectDestroyed.AwaitEach(args)
            };

            _partitionLostEventSubscription = new PartitionLostEventSubscription(_clusterState, this, clusterMembers)
            {
                PartitionLost = args => _partitionLost.AwaitEach(args)
            };
        }