public ClusterMembership(ClusterMembershipConfiguration config,  ILogger logger)
 {
     lastPingTime = DateTime.UtcNow;
     this.config = config;
     this.logger = logger;
     clusterMembers = new ConcurrentDictionary<SocketEndpoint, ClusterMemberMeta>();
 }
 public void Setup()
 {
     pingInterval = TimeSpan.FromSeconds(2);
     membershipConfiguration = new ClusterMembershipConfiguration
     {
         PongSilenceBeforeRouteDeletion = TimeSpan.FromSeconds(4)
     };
     logger = new Mock<ILogger>().Object;
 }
 public ClusterMonitorProvider(ISocketFactory socketFactory,
                               RouterConfiguration routerConfiguration,
                               IClusterMembership clusterMembership,
                               ClusterMembershipConfiguration membershipConfiguration,
                               IRendezvousCluster rendezvousCluster,
                               ILogger logger)
 {
     clusterMonitor = membershipConfiguration.RunAsStandalone
                          ? (IClusterMonitor) new LoopbackClusterMonitor()
                          : new ClusterMonitor(socketFactory,
                                               routerConfiguration,
                                               clusterMembership,
                                               membershipConfiguration,
                                               rendezvousCluster,
                                               logger);
 }
Beispiel #4
0
 public ClusterMonitor(ISocketFactory socketFactory,
                       RouterConfiguration routerConfiguration,
                       IClusterMembership clusterMembership,
                       ClusterMembershipConfiguration membershipConfiguration,
                       IRendezvousCluster rendezvousCluster,
                       ILogger logger)
 {
     this.logger = logger;
     this.membershipConfiguration = membershipConfiguration;
     pingReceived = new ManualResetEventSlim(false);
     newRendezvousConfiguration = new ManualResetEventSlim(false);
     this.socketFactory = socketFactory;
     this.routerConfiguration = routerConfiguration;
     this.clusterMembership = clusterMembership;
     this.rendezvousCluster = rendezvousCluster;
     outgoingMessages = new BlockingCollection<IMessage>(new ConcurrentQueue<IMessage>());
 }
 public void Setup()
 {
     membershipConfiguration = new ClusterMembershipConfiguration
                               {
                                   PongSilenceBeforeRouteDeletion = TimeSpan.FromSeconds(10)
                               };
     routerConfiguration = new RouterConfiguration
                           {
                               ScaleOutAddress = new SocketEndpoint(new Uri(localhost), SocketIdentifier.CreateIdentity()),
                               RouterAddress = new SocketEndpoint(new Uri(localhost), SocketIdentifier.CreateIdentity())
                           };
     messageRouterSocketFactory = new MessageRouterSocketFactory(routerConfiguration);
     clusterMonitor = new Mock<IClusterMonitor>();
     socketFactory = new Mock<ISocketFactory>();
     socketFactory.Setup(m => m.CreateRouterSocket()).Returns(messageRouterSocketFactory.CreateSocket);
     loggerMock = new Mock<ILogger>();
     messageTracer = new Mock<IMessageTracer>();
     logger = new Logger("default");
 }