示例#1
0
        private int SendManagerMessage(ServiceMessageQueue queue, IServiceAddress managerServer, MessageStream messageOut)
        {
            int successCount = 0;

            // Process the message,
            IMessageProcessor     processor = network.Connect(managerServer, ServiceType.Manager);
            IEnumerable <Message> messageIn = processor.Process(messageOut);

            // Handle the response,
            foreach (Message m in messageIn)
            {
                if (m.HasError)
                {
                    log.Error("Manager error: " + m.ErrorMessage);

                    // If we failed, add the message to the retry queue,
                    if (queue != null)
                    {
                        queue.AddMessageStream(managerServer, messageOut, ServiceType.Manager);
                    }
                    // Report the service as down to the tracker,
                    tracker.ReportServiceDownClientReport(managerServer, ServiceType.Manager);
                }
                else
                {
                    // Message successfully sent,
                    ++successCount;
                }
            }

            return(successCount);
        }
示例#2
0
        private int SendRootMessage(ServiceMessageQueue queue, IServiceAddress rootServer, MessageStream messageOut)
        {
            int successCount = 0;

            // Process the message,
            IMessageProcessor     processor = network.Connect(rootServer, ServiceType.Root);
            IEnumerable <Message> messageIn = processor.Process(messageOut);

            // Handle the response,
            foreach (Message m in messageIn)
            {
                if (m.HasError)
                {
                    log.Error("Root error: " + m.ErrorMessage);

                    // If we failed, add the message to the retry queue,
                    if (queue != null)
                    {
                        queue.AddMessageStream(rootServer, messageOut, ServiceType.Root);
                    }

                    // TODO: We should confirm the error is a connection failure before
                    //   reporting the service as down.
                    // Report the service as down to the tracker,
                    tracker.ReportServiceDownClientReport(rootServer, ServiceType.Root);
                }
                else
                {
                    // Message successfully sent,
                    ++successCount;
                }
            }

            return(successCount);
        }
        private int SendRootMessage(ServiceMessageQueue queue, IServiceAddress rootServer, MessageStream messageOut)
        {
            int successCount = 0;

            // Process the message,
            IMessageProcessor processor = network.Connect(rootServer, ServiceType.Root);
            IEnumerable<Message> messageIn = processor.Process(messageOut);

            // Handle the response,
            foreach (Message m in messageIn) {
                if (m.HasError) {
                    log.Error("Root error: " + m.ErrorMessage);

                    // If we failed, add the message to the retry queue,
                    if (queue != null) {
                        queue.AddMessageStream(rootServer, messageOut, ServiceType.Root);
                    }

                    // TODO: We should confirm the error is a connection failure before
                    //   reporting the service as down.
                    // Report the service as down to the tracker,
                    tracker.ReportServiceDownClientReport(rootServer, ServiceType.Root);
                } else {
                    // Message successfully sent,
                    ++successCount;
                }
            }

            return successCount;
        }
        private int SendManagerMessage(ServiceMessageQueue queue, IServiceAddress managerServer, MessageStream messageOut)
        {
            int successCount = 0;

            // Process the message,
            IMessageProcessor processor = network.Connect(managerServer, ServiceType.Manager);
            IEnumerable<Message> messageIn = processor.Process(messageOut);

            // Handle the response,
            foreach (Message m in messageIn) {
                if (m.HasError) {
                    log.Error("Manager error: " + m.ErrorMessage);

                    // If we failed, add the message to the retry queue,
                    if (queue != null) {
                        queue.AddMessageStream(managerServer, messageOut, ServiceType.Manager);
                    }
                    // Report the service as down to the tracker,
                    tracker.ReportServiceDownClientReport(managerServer, ServiceType.Manager);
                } else {
                    // Message successfully sent,
                    ++successCount;
                }
            }

            return successCount;
        }