示例#1
0
        public override string ToString()
        {
            var sb = new StringBuilder();

            sb.AppendFormat("   Messaging:").AppendLine();
            sb.AppendFormat("       Response timeout: {0}", ResponseTimeout).AppendLine();
            sb.AppendFormat("       Maximum resend count: {0}", MaxResendCount).AppendLine();
            sb.AppendFormat("       Resend On Timeout: {0}", ResendOnTimeout).AppendLine();
            sb.AppendFormat("       Maximum Socket Age: {0}", MaxSocketAge).AppendLine();
            sb.AppendFormat("       Drop Expired Messages: {0}", DropExpiredMessages).AppendLine();

            if (isSiloConfig)
            {
                sb.AppendFormat("       Silo Sender queues: {0}", SiloSenderQueues).AppendLine();
                sb.AppendFormat("       Gateway Sender queues: {0}", GatewaySenderQueues).AppendLine();
                sb.AppendFormat("       Client Drop Timeout: {0}", ClientDropTimeout).AppendLine();
            }
            else
            {
                sb.AppendFormat("       Client Sender Buckets: {0}", ClientSenderBuckets).AppendLine();
            }
            sb.AppendFormat("       Buffer Pool Buffer Size: {0}", BufferPoolBufferSize).AppendLine();
            sb.AppendFormat("       Buffer Pool Max Size: {0}", BufferPoolMaxSize).AppendLine();
            sb.AppendFormat("       Buffer Pool Preallocation Size: {0}", BufferPoolPreallocationSize).AppendLine();

            if (isSiloConfig)
            {
                sb.AppendFormat("       Maximum forward count: {0}", MaxForwardCount).AppendLine();
            }

            SerializationProviders.ForEach(sp =>
                                           sb.AppendFormat("       Serialization provider: {0}", sp.FullName).AppendLine());
            sb.AppendFormat("       Fallback serializer: {0}", this.FallbackSerializationProvider?.FullName).AppendLine();
            return(sb.ToString());
        }
示例#2
0
        public override string ToString()
        {
            var sb = new StringBuilder();

            sb.AppendFormat("   Messaging:").AppendLine();
            sb.AppendFormat("       Response timeout: {0}", ResponseTimeout).AppendLine();
            sb.AppendFormat("       Maximum resend count: {0}", MaxResendCount).AppendLine();
            sb.AppendFormat("       Resend On Timeout: {0}", ResendOnTimeout).AppendLine();
            sb.AppendFormat("       Maximum Socket Age: {0}", MaxSocketAge).AppendLine();
            sb.AppendFormat("       Drop Expired Messages: {0}", DropExpiredMessages).AppendLine();
            sb.AppendFormat("       Refresh Reactive Computations: {0}", ReactiveComputationRefresh).AppendLine();

            if (isSiloConfig)
            {
                sb.AppendFormat("       Silo Sender queues: {0}", SiloSenderQueues).AppendLine();
                sb.AppendFormat("       Gateway Sender queues: {0}", GatewaySenderQueues).AppendLine();
                sb.AppendFormat("       Client Drop Timeout: {0}", ClientDropTimeout).AppendLine();
            }
            else
            {
                sb.AppendFormat("       Client Sender Buckets: {0}", ClientSenderBuckets).AppendLine();
            }
            sb.AppendFormat("       Use standard (.NET) serializer: {0}", UseStandardSerializer)
            .AppendLine(isSiloConfig ? "" : "   [NOTE: This *MUST* match the setting on the server or nothing will work!]");
            sb.AppendFormat("       Use fallback json serializer: {0}", UseJsonFallbackSerializer)
            .AppendLine(isSiloConfig ? "" : "   [NOTE: This *MUST* match the setting on the server or nothing will work!]");
            sb.AppendFormat("       Buffer Pool Buffer Size: {0}", BufferPoolBufferSize).AppendLine();
            sb.AppendFormat("       Buffer Pool Max Size: {0}", BufferPoolMaxSize).AppendLine();
            sb.AppendFormat("       Buffer Pool Preallocation Size: {0}", BufferPoolPreallocationSize).AppendLine();
            sb.AppendFormat("       Use Message Batching: {0}", UseMessageBatching).AppendLine();
            sb.AppendFormat("       Max Message Batching Size: {0}", MaxMessageBatchingSize).AppendLine();

            if (isSiloConfig)
            {
                sb.AppendFormat("       Maximum forward count: {0}", MaxForwardCount).AppendLine();
            }

            SerializationProviders.ForEach(sp =>
                                           sb.AppendFormat("       Serialization provider: {0}", sp.FullName).AppendLine());
            return(sb.ToString());
        }
示例#3
0
        internal virtual void Load(XmlElement child)
        {
            ResponseTimeout = child.HasAttribute("ResponseTimeout")
                                      ? ConfigUtilities.ParseTimeSpan(child.GetAttribute("ResponseTimeout"),
                                                                      "Invalid ResponseTimeout")
                                      : MessagingOptions.DEFAULT_RESPONSE_TIMEOUT;

            if (child.HasAttribute("LargeMessageWarningThreshold"))
            {
                LargeMessageWarningThreshold = ConfigUtilities.ParseInt(child.GetAttribute("LargeMessageWarningThreshold"),
                                                                        "Invalid boolean value for LargeMessageWarningThresholdattribute");
            }

            if (child.HasAttribute("MaxResendCount"))
            {
                MaxResendCount = ConfigUtilities.ParseInt(child.GetAttribute("MaxResendCount"),
                                                          "Invalid integer value for the MaxResendCount attribute on the Messaging element");
            }
            if (child.HasAttribute("ResendOnTimeout"))
            {
                ResendOnTimeout = ConfigUtilities.ParseBool(child.GetAttribute("ResendOnTimeout"),
                                                            "Invalid Boolean value for the ResendOnTimeout attribute on the Messaging element");
            }
            if (child.HasAttribute("MaxSocketAge"))
            {
                MaxSocketAge = ConfigUtilities.ParseTimeSpan(child.GetAttribute("MaxSocketAge"),
                                                             "Invalid time span set for the MaxSocketAge attribute on the Messaging element");
            }
            if (child.HasAttribute("DropExpiredMessages"))
            {
                DropExpiredMessages = ConfigUtilities.ParseBool(child.GetAttribute("DropExpiredMessages"),
                                                                "Invalid integer value for the DropExpiredMessages attribute on the Messaging element");
            }
            //--
            if (isSiloConfig)
            {
                if (child.HasAttribute("SiloSenderQueues"))
                {
                    SiloSenderQueues = ConfigUtilities.ParseInt(child.GetAttribute("SiloSenderQueues"),
                                                                "Invalid integer value for the SiloSenderQueues attribute on the Messaging element");
                }
                if (child.HasAttribute("GatewaySenderQueues"))
                {
                    GatewaySenderQueues = ConfigUtilities.ParseInt(child.GetAttribute("GatewaySenderQueues"),
                                                                   "Invalid integer value for the GatewaySenderQueues attribute on the Messaging element");
                }
                ClientDropTimeout = child.HasAttribute("ClientDropTimeout")
                                          ? ConfigUtilities.ParseTimeSpan(child.GetAttribute("ClientDropTimeout"),
                                                                          "Invalid ClientDropTimeout")
                                          : Constants.DEFAULT_CLIENT_DROP_TIMEOUT;
            }
            else
            {
                if (child.HasAttribute("ClientSenderBuckets"))
                {
                    ClientSenderBuckets = ConfigUtilities.ParseInt(child.GetAttribute("ClientSenderBuckets"),
                                                                   "Invalid integer value for the ClientSenderBuckets attribute on the Messaging element");
                }
            }

            //--
            if (child.HasAttribute("BufferPoolBufferSize"))
            {
                BufferPoolBufferSize = ConfigUtilities.ParseInt(child.GetAttribute("BufferPoolBufferSize"),
                                                                "Invalid integer value for the BufferPoolBufferSize attribute on the Messaging element");
            }
            if (child.HasAttribute("BufferPoolMaxSize"))
            {
                BufferPoolMaxSize = ConfigUtilities.ParseInt(child.GetAttribute("BufferPoolMaxSize"),
                                                             "Invalid integer value for the BufferPoolMaxSize attribute on the Messaging element");
            }
            if (child.HasAttribute("BufferPoolPreallocationSize"))
            {
                BufferPoolPreallocationSize = ConfigUtilities.ParseInt(child.GetAttribute("BufferPoolPreallocationSize"),
                                                                       "Invalid integer value for the BufferPoolPreallocationSize attribute on the Messaging element");
            }
            //--
            if (isSiloConfig)
            {
                if (child.HasAttribute("MaxForwardCount"))
                {
                    MaxForwardCount = ConfigUtilities.ParseInt(child.GetAttribute("MaxForwardCount"),
                                                               "Invalid integer value for the MaxForwardCount attribute on the Messaging element");
                }
            }

            if (child.HasChildNodes)
            {
                var serializerNode = child.ChildNodes.OfType <XmlElement>().FirstOrDefault(n => n.Name == "SerializationProviders");
                if (serializerNode != null && serializerNode.HasChildNodes)
                {
                    var typeNames = serializerNode.ChildNodes.OfType <XmlElement>()
                                    .Where(n => n.Name == "Provider")
                                    .Select(e => e.Attributes["type"])
                                    .Where(a => a != null)
                                    .Select(a => a.Value);
                    var types =
                        typeNames.Select(
                            t =>
                            ConfigUtilities.ParseFullyQualifiedType(
                                t,
                                $"The type specification for the 'type' attribute of the Provider element could not be loaded. Type specification: '{t}'."));
                    foreach (var type in types)
                    {
                        var typeinfo = type.GetTypeInfo();
                        ConfigUtilities.ValidateSerializationProvider(typeinfo);
                        if (SerializationProviders.Contains(typeinfo) == false)
                        {
                            SerializationProviders.Add(typeinfo);
                        }
                    }
                }

                var fallbackSerializerNode = child.ChildNodes.OfType <XmlElement>().FirstOrDefault(n => n.Name == "FallbackSerializationProvider");
                if (fallbackSerializerNode != null)
                {
                    var typeName = fallbackSerializerNode.Attributes["type"]?.Value;
                    if (string.IsNullOrWhiteSpace(typeName))
                    {
                        var msg = "The FallbackSerializationProvider element requires a 'type' attribute specifying the fully-qualified type name of the serializer.";
                        throw new FormatException(msg);
                    }

                    var type = ConfigUtilities.ParseFullyQualifiedType(
                        typeName,
                        $"The type specification for the 'type' attribute of the FallbackSerializationProvider element could not be loaded. Type specification: '{typeName}'.");
                    this.FallbackSerializationProvider = type.GetTypeInfo();
                }
            }
        }
示例#4
0
        internal virtual void Load(XmlElement child)
        {
            ResponseTimeout = child.HasAttribute("ResponseTimeout")
                                      ? ConfigUtilities.ParseTimeSpan(child.GetAttribute("ResponseTimeout"),
                                                                      "Invalid ResponseTimeout")
                                      : Constants.DEFAULT_RESPONSE_TIMEOUT;

            if (child.HasAttribute("MaxResendCount"))
            {
                MaxResendCount = ConfigUtilities.ParseInt(child.GetAttribute("MaxResendCount"),
                                                          "Invalid integer value for the MaxResendCount attribute on the Messaging element");
            }
            if (child.HasAttribute("ResendOnTimeout"))
            {
                ResendOnTimeout = ConfigUtilities.ParseBool(child.GetAttribute("ResendOnTimeout"),
                                                            "Invalid Boolean value for the ResendOnTimeout attribute on the Messaging element");
            }
            if (child.HasAttribute("MaxSocketAge"))
            {
                MaxSocketAge = ConfigUtilities.ParseTimeSpan(child.GetAttribute("MaxSocketAge"),
                                                             "Invalid time span set for the MaxSocketAge attribute on the Messaging element");
            }
            if (child.HasAttribute("DropExpiredMessages"))
            {
                DropExpiredMessages = ConfigUtilities.ParseBool(child.GetAttribute("DropExpiredMessages"),
                                                                "Invalid integer value for the DropExpiredMessages attribute on the Messaging element");
            }
            //--
            if (isSiloConfig)
            {
                if (child.HasAttribute("SiloSenderQueues"))
                {
                    SiloSenderQueues = ConfigUtilities.ParseInt(child.GetAttribute("SiloSenderQueues"),
                                                                "Invalid integer value for the SiloSenderQueues attribute on the Messaging element");
                }
                if (child.HasAttribute("GatewaySenderQueues"))
                {
                    GatewaySenderQueues = ConfigUtilities.ParseInt(child.GetAttribute("GatewaySenderQueues"),
                                                                   "Invalid integer value for the GatewaySenderQueues attribute on the Messaging element");
                }
                ClientDropTimeout = child.HasAttribute("ClientDropTimeout")
                                          ? ConfigUtilities.ParseTimeSpan(child.GetAttribute("ClientDropTimeout"),
                                                                          "Invalid ClientDropTimeout")
                                          : Constants.DEFAULT_CLIENT_DROP_TIMEOUT;
            }
            else
            {
                if (child.HasAttribute("ClientSenderBuckets"))
                {
                    ClientSenderBuckets = ConfigUtilities.ParseInt(child.GetAttribute("ClientSenderBuckets"),
                                                                   "Invalid integer value for the ClientSenderBuckets attribute on the Messaging element");
                }
            }
            if (child.HasAttribute("UseStandardSerializer"))
            {
                UseStandardSerializer =
                    ConfigUtilities.ParseBool(child.GetAttribute("UseStandardSerializer"),
                                              "invalid boolean value for the UseStandardSerializer attribute on the Messaging element");
            }

            if (child.HasAttribute("UseJsonFallbackSerializer"))
            {
                UseJsonFallbackSerializer =
                    ConfigUtilities.ParseBool(child.GetAttribute("UseJsonFallbackSerializer"),
                                              "invalid boolean value for the UseJsonFallbackSerializer attribute on the Messaging element");
            }

            //--
            if (child.HasAttribute("BufferPoolBufferSize"))
            {
                BufferPoolBufferSize = ConfigUtilities.ParseInt(child.GetAttribute("BufferPoolBufferSize"),
                                                                "Invalid integer value for the BufferPoolBufferSize attribute on the Messaging element");
            }
            if (child.HasAttribute("BufferPoolMaxSize"))
            {
                BufferPoolMaxSize = ConfigUtilities.ParseInt(child.GetAttribute("BufferPoolMaxSize"),
                                                             "Invalid integer value for the BufferPoolMaxSize attribute on the Messaging element");
            }
            if (child.HasAttribute("BufferPoolPreallocationSize"))
            {
                BufferPoolPreallocationSize = ConfigUtilities.ParseInt(child.GetAttribute("BufferPoolPreallocationSize"),
                                                                       "Invalid integer value for the BufferPoolPreallocationSize attribute on the Messaging element");
            }
            if (child.HasAttribute("UseMessageBatching"))
            {
                UseMessageBatching = ConfigUtilities.ParseBool(child.GetAttribute("UseMessageBatching"),
                                                               "Invalid boolean value for the UseMessageBatching attribute on the Messaging element");
            }
            if (child.HasAttribute("MaxMessageBatchingSize"))
            {
                MaxMessageBatchingSize = ConfigUtilities.ParseInt(child.GetAttribute("MaxMessageBatchingSize"),
                                                                  "Invalid integer value for the MaxMessageBatchingSize attribute on the Messaging element");
            }
            //--
            if (isSiloConfig)
            {
                if (child.HasAttribute("MaxForwardCount"))
                {
                    MaxForwardCount = ConfigUtilities.ParseInt(child.GetAttribute("MaxForwardCount"),
                                                               "Invalid integer value for the MaxForwardCount attribute on the Messaging element");
                }
            }

            if (child.HasChildNodes)
            {
                var serializerNode = child.ChildNodes.OfType <XmlElement>().FirstOrDefault(n => n.Name == "SerializationProviders");
                if (serializerNode != null && serializerNode.HasChildNodes)
                {
                    var typeNames = serializerNode.ChildNodes.OfType <XmlElement>()
                                    .Where(n => n.Name == "Provider")
                                    .Select(e => e.Attributes["type"])
                                    .Where(a => a != null)
                                    .Select(a => a.Value);
                    var types = typeNames.Select(t => ConfigUtilities.ParseFullyQualifiedType(t, "The type specification for the 'type' attribute of the Provider element could not be loaded"));
                    foreach (var type in types)
                    {
                        var typeinfo = type.GetTypeInfo();
                        ConfigUtilities.ValidateSerializationProvider(typeinfo);
                        if (SerializationProviders.Contains(typeinfo) == false)
                        {
                            SerializationProviders.Add(typeinfo);
                        }
                    }
                }
            }
        }