private void CheckPeerConnection(ReceiverIdentifier nodeIdentifier, ClusterMemberMeta meta)
 {
     if (!meta.ConnectionEstablished)
     {
         using (var socket = socketFactory.CreateRouterSocket())
         {
             var uri = new Uri(meta.ScaleOutUri);
             try
             {
                 socket.SetMandatoryRouting();
                 socket.Connect(uri, waitUntilConnected: true);
                 var message = Message.Create(new PingMessage())
                               .As <Message>();
                 message.SetDomain(securityProvider.GetDomain(KinoMessages.Ping.Identity));
                 message.SetSocketIdentity(nodeIdentifier.Identity);
                 message.SignMessage(securityProvider);
                 socket.SendMessage(message);
                 socket.Disconnect(uri);
                 meta.LastKnownHeartBeat = DateTime.UtcNow;
             }
             catch (Exception err)
             {
                 routerLocalSocket.Send(Message.Create(new UnregisterUnreachableNodeMessage {
                     ReceiverNodeIdentity = nodeIdentifier.Identity
                 }));
                 logger.Warn($"Failed trying to check connectivity to node {nodeIdentifier}@{uri.ToSocketAddress()}. Peer deletion scheduled. {err}");
             }
         }
     }
 }
示例#2
0
        private ISocket CreateScaleOutFrontendSocket()
        {
            var socket = socketFactory.CreateRouterSocket();

            foreach (var scaleOutAddress in scaleOutConfigurationManager.GetScaleOutAddressRange())
            {
                try
                {
                    socket.SetIdentity(scaleOutAddress.Identity);
                    socket.SetMandatoryRouting();
                    socket.SetReceiveHighWaterMark(GetScaleOutReceiveMessageQueueLength());
                    socket.ReceiveRate = performanceCounterManager.GetCounter(KinoPerformanceCounters.MessageRouterScaleoutFrontendSocketReceiveRate);

                    socket.Bind(scaleOutAddress.Uri);
                    scaleOutConfigurationManager.SetActiveScaleOutAddress(scaleOutAddress);

                    logger.Info($"MessageRouter started at Uri:{scaleOutAddress.Uri.ToSocketAddress()} " +
                                $"Identity:{scaleOutAddress.Identity.GetAnyString()}");

                    return(socket);
                }
                catch
                {
                    logger.Info($"Failed to bind to {scaleOutAddress.Uri.ToSocketAddress()}, retrying with next endpoint...");
                }
            }

            throw new Exception("Failed to bind to any of the configured ScaleOut endpoints!");
        }
示例#3
0
        private ISocket CreateScaleOutBackendSocket()
        {
            var socket = socketFactory.CreateRouterSocket();

            socket.SetMandatoryRouting();
            socket.SendRate = performanceCounterManager.GetCounter(KinoPerformanceCounters.MessageRouterScaleoutBackendSocketSendRate);

            return(socket);
        }
示例#4
0
        private ISocket CreateUnicastSocket()
        {
            var socket = socketFactory.CreateRouterSocket();

            socket.ReceiveRate = performanceCounterManager.GetCounter(KinoPerformanceCounters.RendezvousSocketReceiveRate);
            socket.Bind(configProvider.UnicastUri);

            return(socket);
        }